function Action::create
Overrides EntityBase::create
13 calls to Action::create()
- ActionResourceTestBase::createEntity in core/modules/ system/ tests/ src/ Functional/ Rest/ ActionResourceTestBase.php 
- Creates the entity to be tested.
- ActionTest::createEntity in core/modules/ jsonapi/ tests/ src/ Functional/ ActionTest.php 
- Creates the entity to be tested.
- ActionTest::testDependencies in core/modules/ system/ tests/ src/ Kernel/ Action/ ActionTest.php 
- Tests the dependency calculation of actions.
- ActionValidationTest::setUp in core/modules/ system/ tests/ src/ Kernel/ Entity/ ActionValidationTest.php 
- ConfigEntityImportTest::doActionUpdate in core/modules/ system/ tests/ src/ Kernel/ Entity/ ConfigEntityImportTest.php 
- Tests updating an action during import.
File
- 
              core/modules/ system/ src/ Entity/ Action.php, line 88 
Class
- Action
- Defines the configured action entity.
Namespace
Drupal\system\EntityCode
public static function create(array $values = []) {
  // When no label is specified for this action config entity, default to the
  // label of the used action plugin.
  if (!array_key_exists('label', $values) && array_key_exists('plugin', $values)) {
    try {
      $action_plugin_manager = \Drupal::service('plugin.manager.action');
      assert($action_plugin_manager instanceof PluginManagerInterface);
      $action_plugin_definition = $action_plugin_manager->getDefinition($values['plugin']);
      // @see \Drupal\Core\Annotation\Action::$label
      assert(array_key_exists('label', $action_plugin_definition));
      $values['label'] = $action_plugin_definition['label'];
    } catch (PluginNotFoundException) {
    }
  }
  return parent::create($values);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
