Example #1
0
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     $definition = FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('value');
     if ($field_definition->getType() === 'string') {
         $definition->markPropertyUnique('value');
     }
     return $definition;
 }
Example #2
0
File: Text.php Project: Tawreh/mtg
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     $definition = FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('value');
     if ($field_definition->getType() === 'text_with_summary') {
         $definition->addProperty('summary');
     }
     return $definition;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     // Only reference content entities. Configuration entities will need custom
     // targets.
     $type = $field_definition->getSetting('target_type');
     if (!\Drupal::entityManager()->getDefinition($type)->isSubclassOf('\\Drupal\\Core\\Entity\\ContentEntityInterface')) {
         return;
     }
     return FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('target_id');
 }
Example #4
0
File: Link.php Project: Tawreh/mtg
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     return FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('uri')->addProperty('title');
 }
Example #5
0
File: Uri.php Project: Tawreh/mtg
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     return FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('value')->markPropertyUnique('value');
 }
Example #6
0
File: File.php Project: Tawreh/mtg
 /**
  * {@inheritdoc}
  */
 protected static function prepareTarget(FieldDefinitionInterface $field_definition)
 {
     return FieldTargetDefinition::createFromFieldDefinition($field_definition)->addProperty('target_id')->addProperty('description');
 }