Example #1
0
 /**
  * Overrides TypedData::__construct().
  */
 public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL)
 {
     parent::__construct($definition, $name, $parent);
     if ($definition->getSetting('text source') === NULL) {
         throw new \InvalidArgumentException("The definition's 'text source' key has to specify the name of the text property to be processed.");
     }
 }
 /**
  * {@inheritdoc}
  */
 public function setValue($value, $notify = TRUE)
 {
     if (!$value instanceof PluginInspectionInterface) {
         $value = NULL;
     }
     parent::setValue($value, $notify);
 }
 /**
  * {@inheritdoc}
  */
 public function setValue($value, $notify = TRUE)
 {
     // Normalize the path in case it is an alias.
     $value = \Drupal::service('path.alias_manager')->getPathByAlias($value);
     if (empty($value)) {
         $value = '<front>';
     }
     parent::setValue($value, $notify);
 }
 /**
  * Constructs a new instance.
  *
  * @param \Drupal\Core\TypedData\DataDefinitionInterface $definition
  *   The data definition.
  * @param string $name
  *   The name of the created property.
  * @param \Drupal\plugin\Plugin\Field\FieldType\PluginCollectionItemInterface $parent
  *   The parent object of the data property.
  */
 public function __construct(DataDefinitionInterface $definition, $name, PluginCollectionItemInterface $parent)
 {
     parent::__construct($definition, $name, $parent);
 }