Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / Plugin / Action / rulesaction.php.twig
diff --git a/vendor/drupal/console/templates/module/src/Plugin/Action/rulesaction.php.twig b/vendor/drupal/console/templates/module/src/Plugin/Action/rulesaction.php.twig
new file mode 100644 (file)
index 0000000..fb08125
--- /dev/null
@@ -0,0 +1,44 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{module}}\Plugin\Action\{{class_name}}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{module}}\Plugin\Action;
+{% endblock %}
+
+{% block use_class %}
+use Drupal\Core\Action\ActionBase;
+use Drupal\Core\Session\AccountInterface;
+{% endblock %}
+
+{% block class_declaration %}
+/**
+ * Provides a '{{class_name}}' action.
+ *
+ * @Action(
+ *  id = "{{plugin_id}}",
+ *  label = @Translation("{{label}}"),
+ *  type = "{{type}}",
+ * )
+ */
+class {{class_name}} extends ActionBase {% endblock %}
+{% block class_methods %}
+  /**
+   * {@inheritdoc}
+   */
+  public function execute($object = NULL) {
+    // Insert code here.
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
+    $access = $object->status->access('edit', $account, TRUE)
+      ->andIf($object->access('update', $account, TRUE));
+
+    return $return_as_object ? $access : $access->isAllowed();
+  }
+{% endblock %}