modules/custom/youmodule/config/system.action.your_action_name_action.yml
id: your_action_name_action label: 'ノードにXXを事をする' status: true langcode: en type: node plugin: your_action_name_action dependencies: module: - node
modules/custom/youmodule/src/Plugin/Action/YourActionName.php
<?php namespace Drupal\image_manager\Plugin\Action; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; use Drupal\node\Entity\Node; /** * ノードをXXする。 * * @Action( * id = "your_action_name_action", * label = @Translation("Your Action Name"), * type = "node" * ) */ class YourActionName extends ActionBase { /** * {@inheritdoc} */ public function execute($node = NULL) { $node----->set('field_xxxxx', $node->get('field_yyyyy')->value + 1); 〜 $node->save(); } /** * {@inheritdoc} */ public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $isEnable = 〜 // = $object->access('delete', $account, $return_as_object); とか return $isEnable; } }