I am creating VBO custom action and I constantly see the below error:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "publish_TR_action" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: node_export_action, comment_unpublish_by_keyword_action, entity_delete_action:comment, node_assign_owner_action, node_unpromote_action, node_promote_action, node_make_sticky_action, node_unpublish_by_keyword_action, node_make_unsticky_action, bulk_node_export, user_add_role_action..........
under the module folder I have the below file : /web/modules/custom\mymod/config/install/system.action.publish_comment_action.yml
langcode: en
status: true
dependencies:
module:
- comment
id: publish_TR_action
label: 'Publish comment and create the T&R'
type: ""
plugin: publish_TR_action
configuration: { }
Next, I made a action class under /src/plugin folder: web/modules/custom/mymod/src/Plugin/Action/PublishTRAction.php
<?php
namespace Drupal\mymod\Plugin\Action;
use Drupal\views_bulk_operations\Action\ViewsBulkOperationsActionBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
* create custom action
*
* @Action(
* id = "node_export_action",
* label = @Translation("Export Content"),
* type = "node"
* )
*/
class PublishTRAction extends ViewsBulkOperationsActionBase {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function execute($entity = NULL) {
// Do some processing..
// Don't return anything for a default completion message, otherwise return translatable markup.
return $this->t('Some result');
}
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
if ($object->getEntityType() === 'node') {
$access = $object->access('update', $account, TRUE)
->andIf($object->status->access('edit', $account, TRUE));
return $return_as_object ? $access : $access->isAllowed();
}
// Other entity types may have different
// access methods and properties.
return TRUE;
}
}
I uninstalled the module and while re-installing I see the above error. Any help??!
I am using Drupal 9.