I'm creating a view that is used to review migrated content that was flagged for review during the migration process. I want to provide a bulk action on this view that allows the user to select a bunch and mark them as "resolved".

I created a custom action to do this following some guidance from https://www.drupal.org/node/2330631:


langcode: en
status: true
    - node
id: resolve_news_migration_flag
label: 'Resolve news migration flag'
type: node
plugin: resolve_news_migration_flag
configuration: {  }

And created the action plugin implementation:



namespace Drupal\pu_news_migrate\Plugin\Action;

use Drupal\Core\Action\ActionBase;
use Drupal\Core\Session\AccountInterface;

 * Removes the "needs review" flag on a migrated news article.
 * @Action(
 *   id = "resolve_news_migration_flag",
 *   label = @Translation("Resolve news migration flag"),
 *   type = "node"
 * )
class ResolveNewsMigrationFlag extends ActionBase {

   * {@inheritdoc}
  public function execute($node = NULL) {
    if ($node) {
      /** @var \Drupal\node\NodeInterface $node */
      if (!$node->hasField('field_news_migration_review')) {
        throw new \RuntimeException("News migration field not found on node.");
      $node->set('field_news_migration_review', FALSE);

   * {@inheritdoc}
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
    /** @var \Drupal\node\NodeInterface $object */
    $result = $object->field_news_migration_review->access('edit', $account, TRUE)
      ->andIf($object->access('update', $account, TRUE));

    return $return_as_object ? $result : $result->isAllowed();


I also added a schema file: config/schema/pu_news_migrate.schema.yml:

  type: resolve_news_migration_flag
  label: 'Remove the "needs review" flag from a migrated article.'

I uninstalled the module and re-installed it so that the action definition is loaded into Drupal's config.

However, when I view the list of actions I can select in views, it doesn't appear there. I enabled the "Actions" module which displays a list of all actions, and it does not appear there either.

What did I do wrong here?

  • Did you also provide a schema.yml file? Check the node module for an example. I also think the name of the file needs to be system.action.... not pu_news_migrate
    – Kevin
    Commented Mar 15, 2017 at 13:20
  • Yes, just updated question with that snippet
    – Brian
    Commented Mar 15, 2017 at 15:06
  • Did you try renaming the plugin yaml file name to system.action.., uninstalling and reinstalling? The actions in node and user are named this way, not node.action.blahblah.
    – Kevin
    Commented Mar 15, 2017 at 15:27
  • 1
    Kevin, that was it! If you post that as an answer I can can accept your answer and bounty.
    – Brian
    Commented Mar 16, 2017 at 17:00
  • I thought so, just wanted to double check. Answer added.
    – Kevin
    Commented Mar 16, 2017 at 17:01

1 Answer 1


Action plugin yaml definitions need to be prefixed with the name system.action.action_name.yml, and not mymodule.action_name.yml.

For reference, check the provided action plugins for node and user module in core in their config/install and config/schema folders.

Uninstall the module, rename the files, and install the module again so the changes are picked up. You should then see your custom action.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.