class TypedDataEntityRelationshipDeriver

Same name in other branches
  1. 8.x-3.x src/Plugin/Deriver/TypedDataEntityRelationshipDeriver.php \Drupal\ctools\Plugin\Deriver\TypedDataEntityRelationshipDeriver

Hierarchy

Expanded class hierarchy of TypedDataEntityRelationshipDeriver

File

src/Plugin/Deriver/TypedDataEntityRelationshipDeriver.php, line 10

Namespace

Drupal\ctools\Plugin\Deriver
View source
class TypedDataEntityRelationshipDeriver extends TypedDataRelationshipDeriver {
    
    /**
     * {@inheritdoc}
     */
    protected $label = '@property Entity from @base';
    
    /**
     * {@inheritdoc}
     */
    protected function generateDerivativeDefinition($base_plugin_definition, $data_type_id, $data_type_definition, DataDefinitionInterface $base_definition, $property_name, DataDefinitionInterface $property_definition) {
        if (method_exists($property_definition, 'getType') && $property_definition->getType() == 'entity_reference') {
            parent::generateDerivativeDefinition($base_plugin_definition, $data_type_id, $data_type_definition, $base_definition, $property_name, $property_definition);
            // Provide the entity type.
            $derivative_id = $data_type_id . ':' . $property_name;
            if (isset($this->derivatives[$derivative_id])) {
                $this->derivatives[$derivative_id]['target_entity_type'] = $property_definition->getFieldStorageDefinition()
                    ->getPropertyDefinition('entity')
                    ->getConstraint('EntityType');
            }
        }
    }

}

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
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.
TypedDataEntityRelationshipDeriver::$label protected property The label string for use with derivative labels. Overrides TypedDataPropertyDeriverBase::$label
TypedDataEntityRelationshipDeriver::generateDerivativeDefinition protected function Generates and maintains a derivative definition. Overrides TypedDataRelationshipDeriver::generateDerivativeDefinition
TypedDataPropertyDeriverBase::$typedDataManager protected property
TypedDataPropertyDeriverBase::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
TypedDataPropertyDeriverBase::getDataType protected function
TypedDataPropertyDeriverBase::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions 1
TypedDataPropertyDeriverBase::__construct public function TypedDataPropertyDeriverBase constructor.