class TypedDataLanguageRelationshipDeriver

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

Hierarchy

Expanded class hierarchy of TypedDataLanguageRelationshipDeriver

File

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

Namespace

Drupal\ctools\Plugin\Deriver
View source
class TypedDataLanguageRelationshipDeriver extends TypedDataRelationshipDeriver {
    
    /**
     * {@inheritdoc}
     *
     * @todo this results in awful labels like "Language Language from Content"
     * Fix it.
     */
    protected $label = '@property Language 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() == 'language') {
            parent::generateDerivativeDefinition($base_plugin_definition, $data_type_id, $data_type_definition, $base_definition, $property_name, $property_definition);
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinitions($base_plugin_definition) {
        parent::getDerivativeDefinitions($base_plugin_definition);
        // The data types will all be set to string since language extends string
        // and the parent class finds the related primitive.
        foreach ($this->derivatives as $plugin_id => $derivative) {
            $this->derivatives[$plugin_id]['data_type'] = 'language';
        }
        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
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.
TypedDataLanguageRelationshipDeriver::$label protected property @todo this results in awful labels like "Language Language from Content"
Fix it.
Overrides TypedDataPropertyDeriverBase::$label
TypedDataLanguageRelationshipDeriver::generateDerivativeDefinition protected function Generates and maintains a derivative definition. Overrides TypedDataRelationshipDeriver::generateDerivativeDefinition
TypedDataLanguageRelationshipDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides TypedDataPropertyDeriverBase::getDerivativeDefinitions
TypedDataPropertyDeriverBase::$typedDataManager protected property
TypedDataPropertyDeriverBase::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
TypedDataPropertyDeriverBase::getDataType protected function
TypedDataPropertyDeriverBase::__construct public function TypedDataPropertyDeriverBase constructor.