Last active
January 1, 2016 18:39
-
-
Save EclipseGc/8184824 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// My code for getting this output. | |
$definition = new DataDefinition(\Drupal::service('typed_data')->getDefinition('entity')); | |
$definition->setDataType('entity'); | |
$definition->addConstraint('EntityType', 'node'); | |
drupal_set_message('<pre>' . print_r($definition, TRUE) . '</pre>'); | |
$definition2 = new DataDefinition(\Drupal::service('typed_data')->getDefinition('entity:node')); | |
drupal_set_message('<pre>' . print_r($definition2, TRUE) . '</pre>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $definition print_r() | |
Drupal\Core\TypedData\DataDefinition Object | |
( | |
[definition:protected] => Array | |
( | |
[list_class] => \Drupal\Core\TypedData\Plugin\DataType\ItemList | |
[id] => entity | |
[label] => Entity | |
[description] => All kind of entities, e.g. nodes, comments or users. | |
[derivative] => \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver | |
[class] => Drupal\Core\Entity\Plugin\DataType\Entity | |
[provider] => Core | |
[type] => entity | |
[constraints] => Array | |
( | |
[EntityType] => node | |
) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $definition2 print_r() | |
Drupal\Core\TypedData\DataDefinition Object | |
( | |
[definition:protected] => Array | |
( | |
[label] => Content | |
[class] => Drupal\node\Entity\Node | |
[constraints] => Array | |
( | |
[EntityType] => node | |
) | |
[list_class] => \Drupal\Core\TypedData\Plugin\DataType\ItemList | |
[id] => entity | |
[description] => All kind of entities, e.g. nodes, comments or users. | |
[derivative] => \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver | |
[provider] => Core | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment