class EntityCreateDeriver

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

@internal This API is experimental.

Hierarchy

Expanded class hierarchy of EntityCreateDeriver

1 file declares its use of EntityCreateDeriver
EntityCreate.php in core/lib/Drupal/Core/Config/Action/Plugin/ConfigAction/EntityCreate.php

File

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

Namespace

Drupal\Core\Config\Action\Plugin\ConfigAction\Deriver
View source
final class EntityCreateDeriver extends DeriverBase {
    use StringTranslationTrait;
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
EntityCreateDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

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