TypedDataLanguageRelationship.php in Chaos Tool Suite (ctools) 8.3
File
src/Plugin/Relationship/TypedDataLanguageRelationship.php
View source
<?php
namespace Drupal\ctools\Plugin\Relationship;
use Drupal\Core\Plugin\Context\Context;
use Drupal\Core\Plugin\Context\ContextDefinition;
class TypedDataLanguageRelationship extends TypedDataRelationship {
public function getRelationship() {
$plugin_definition = $this
->getPluginDefinition();
$context_definition = new ContextDefinition("language", $plugin_definition['label']);
$context_value = NULL;
if ($this
->getContext('base')
->hasContextValue()) {
$context_value = $this
->getData($this
->getContext('base'))->language;
}
$context_definition
->setDefaultValue($context_value);
return new Context($context_definition, $context_value);
}
}
Classes
Name |
Description |
TypedDataLanguageRelationship |
Plugin annotation
@Relationship(
id = "typed_data_language_relationship",
deriver = "\Drupal\ctools\Plugin\Deriver\TypedDataLanguageRelationshipDeriver"
) |