NodeSchema.php in Schemata 8
File
src/Schema/NodeSchema.php
View source
<?php
namespace Drupal\schemata\Schema;
use Drupal\node\Entity\NodeType;
use Drupal\Core\Entity\TypedData\EntityDataDefinitionInterface;
class NodeSchema extends Schema {
protected $nodeType;
public function __construct(EntityDataDefinitionInterface $entity_type, $bundle = NULL, $properties = []) {
$this->nodeType = NodeType::load($bundle);
parent::__construct($entity_type, $bundle, $properties);
}
protected function createDescription($entityType, $bundle = '') {
$description = $this->nodeType
->getDescription();
if (empty($description)) {
return parent::createDescription($entityType, $bundle);
}
return addslashes(strip_tags($description));
}
}