class NodeSchema in Schemata 8
Specialized schema for Node Entities.
Leverages NodeType configuration for additional metadata.
Hierarchy
- class \Drupal\schemata\Schema\Schema implements RefinableCacheableDependencyInterface, SchemaInterface uses RefinableCacheableDependencyTrait
- class \Drupal\schemata\Schema\NodeSchema
Expanded class hierarchy of NodeSchema
2 files declare their use of NodeSchema
- SchemaFactory.php in src/
SchemaFactory.php - SchemaFactoryTest.php in tests/
src/ Kernel/ SchemaFactoryTest.php
File
- src/
Schema/ NodeSchema.php, line 13
Namespace
Drupal\schemata\SchemaView source
class NodeSchema extends Schema {
/**
* NodeType associated with the current bundle.
*
* @var \Drupal\node\Entity\NodeType
*/
protected $nodeType;
/**
* {@inheritdoc}
*/
public function __construct(EntityDataDefinitionInterface $entity_type, $bundle = NULL, $properties = []) {
$this->nodeType = NodeType::load($bundle);
parent::__construct($entity_type, $bundle, $properties);
}
/**
* {@inheritdoc}
*/
protected function createDescription($entityType, $bundle = '') {
$description = $this->nodeType
->getDescription();
if (empty($description)) {
return parent::createDescription($entityType, $bundle);
}
return addslashes(strip_tags($description));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
NodeSchema:: |
protected | property | NodeType associated with the current bundle. | |
NodeSchema:: |
protected | function |
Generates a description for the schema based on the types. Overrides Schema:: |
|
NodeSchema:: |
public | function |
Creates a Schema object. Overrides Schema:: |
|
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
Schema:: |
protected | property | The Entity Type bundle this schema describes, if one exists. | |
Schema:: |
protected | property | The Entity Type this schema describes. | |
Schema:: |
protected | property | Metadata values that describe the schema. | |
Schema:: |
protected | property | Typed Data objects for all properties on the entity type/bundle. | |
Schema:: |
public | function |
Add additional data properties to the Schema. Overrides SchemaInterface:: |
|
Schema:: |
protected | function | Generates a title for the schema based on a simple trio of parameters. | |
Schema:: |
public | function |
Retrieve the Bundle ID. Overrides SchemaInterface:: |
|
Schema:: |
public | function |
Retrieve the Entity Type ID. Overrides SchemaInterface:: |
|
Schema:: |
public | function |
Retrieve the Schema metadata. Overrides SchemaInterface:: |
|
Schema:: |
public | function |
Retrieve the Schema properties. Overrides SchemaInterface:: |
|
Schema:: |
public | function | Magic method: Gets a property value. | |
Schema:: |
public | function | Magic method: Determines whether a property is set. | |
Schema:: |
public | function | Magic method: Sets a property value. | |
Schema:: |
public | function | Magic method: Unsets a property. |