You are here

function _create_action in Convert Bundles 8

Create Action.

2 calls to _create_action()
convert_bundles_entity_operation_alter in ./convert_bundles.module
Implements hook_entity_operation_alter().
convert_bundles_install in ./convert_bundles.install
Implements hook_install().

File

./convert_bundles.module, line 41
Contains convert_bundles.module..

Code

function _create_action($entity_type_machine_name, $entity_type_label) {
  $label = 'Convert ' . $entity_type_label . ' Entity Bundles';

  // Creating a new configured action.
  $action = Action::create([
    'id' => 'convert_bundles_on_' . $entity_type_machine_name,
    'label' => $label,
    'type' => $entity_type_machine_name,
    'configuration' => [],
    'plugin' => 'convert_bundles_action_base',
  ]);
  $action
    ->save();
  \Drupal::messenger()
    ->addStatus(t('Action @label created from convert_bundles module.', [
    '@label' => $label,
  ]));
}