Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / templates / module / src / Plugin / Action / rulesaction.php.twig
1 {% extends "base/class.php.twig" %}
2
3 {% block file_path %}
4 \Drupal\{{module}}\Plugin\Action\{{class_name}}.
5 {% endblock %}
6
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\Plugin\Action;
9 {% endblock %}
10
11 {% block use_class %}
12 use Drupal\Core\Action\ActionBase;
13 use Drupal\Core\Session\AccountInterface;
14 {% endblock %}
15
16 {% block class_declaration %}
17 /**
18  * Provides a '{{class_name}}' action.
19  *
20  * @Action(
21  *  id = "{{plugin_id}}",
22  *  label = @Translation("{{label}}"),
23  *  type = "{{type}}",
24  * )
25  */
26 class {{class_name}} extends ActionBase {% endblock %}
27 {% block class_methods %}
28   /**
29    * {@inheritdoc}
30    */
31   public function execute($object = NULL) {
32     // Insert code here.
33   }
34
35   /**
36    * {@inheritdoc}
37    */
38   public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
39     $access = $object->status->access('edit', $account, TRUE)
40       ->andIf($object->access('update', $account, TRUE));
41
42     return $return_as_object ? $access : $access->isAllowed();
43   }
44 {% endblock %}