X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FAction%2Frulesaction.php.twig;fp=vendor%2Fdrupal%2Fconsole%2Ftemplates%2Fmodule%2Fsrc%2FPlugin%2FAction%2Frulesaction.php.twig;h=fb0812528a2758230bbe45506b740a4defadad70;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website 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 index 000000000..fb0812528 --- /dev/null +++ b/vendor/drupal/console/templates/module/src/Plugin/Action/rulesaction.php.twig @@ -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 %}