function EntityCreateDeriver::getDerivativeDefinitions

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/Deriver/EntityCreateDeriver.php \Drupal\Core\Config\Action\Plugin\ConfigAction\Deriver\EntityCreateDeriver::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/Deriver/EntityCreateDeriver.php, line 21

Class

EntityCreateDeriver
@internal This API is experimental.

Namespace

Drupal\Core\Config\Action\Plugin\ConfigAction\Deriver

Code

public function getDerivativeDefinitions($base_plugin_definition) {
    // These derivatives apply to all entity types.
    $base_plugin_definition['entity_types'] = [
        '*',
    ];
    $this->derivatives['createIfNotExists'] = $base_plugin_definition + [
        'constructor_args' => [
            'exists' => Exists::ReturnEarlyIfExists,
        ],
    ];
    $this->derivatives['createIfNotExists']['admin_label'] = $this->t('Create entity if it does not exist');
    $this->derivatives['create'] = $base_plugin_definition + [
        'constructor_args' => [
            'exists' => Exists::ErrorIfExists,
        ],
    ];
    $this->derivatives['create']['admin_label'] = $this->t('Entity create');
    return $this->derivatives;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.