class LayoutSectionItem
Same name and namespace in other branches
- 11.x core/modules/layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem
- 10 core/modules/layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem
- 9 core/modules/layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem
- 8.9.x core/modules/layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem
Plugin implementation of the 'layout_section' field type.
@internal Plugin classes are internal.
@property \Drupal\layout_builder\Section $section
Attributes
#[FieldType(id: "layout_section", label: new TranslatableMarkup("Layout Section"), description: new TranslatableMarkup("Layout Section"), no_ui: TRUE, list_class: LayoutSectionItemList::class, cardinality: FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)]
Hierarchy
- class \Drupal\Core\TypedData\TypedData implements \Drupal\Core\TypedData\TypedDataInterface, \Drupal\Component\Plugin\PluginInspectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\TypedData\TypedDataTrait
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem extends \Drupal\Core\Field\FieldItemBase
- class \Drupal\Core\Field\FieldItemBase implements \Drupal\Core\Field\FieldItemInterface extends \Drupal\Core\TypedData\Plugin\DataType\Map
- class \Drupal\Core\TypedData\Plugin\DataType\Map implements \Drupal\Core\TypedData\Plugin\DataType\IteratorAggregate, \Drupal\Core\TypedData\ComplexDataInterface extends \Drupal\Core\TypedData\TypedData
Expanded class hierarchy of LayoutSectionItem
1 file declares its use of LayoutSectionItem
- DefaultContentSubscriber.php in core/
modules/ layout_builder/ src/ EventSubscriber/ DefaultContentSubscriber.php
File
-
core/
modules/ layout_builder/ src/ Plugin/ Field/ FieldType/ LayoutSectionItem.php, line 22
Namespace
Drupal\layout_builder\Plugin\Field\FieldTypeView source
class LayoutSectionItem extends FieldItemBase {
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['section'] = DataDefinition::create('layout_section')->setLabel(new TranslatableMarkup('Layout Section'))
->setRequired(FALSE);
return $properties;
}
/**
* {@inheritdoc}
*/
public function __get($name) {
// @todo \Drupal\Core\Field\FieldItemBase::__get() does not return default
// values for un-instantiated properties. This will forcibly instantiate
// all properties with the side-effect of a performance hit, resolve
// properly in https://www.drupal.org/node/2413471.
$this->getProperties();
return parent::__get($name);
}
/**
* {@inheritdoc}
*/
public static function mainPropertyName() {
return 'section';
}
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
$schema = [
'columns' => [
'section' => [
'type' => 'blob',
'size' => 'normal',
'serialize' => TRUE,
],
],
];
return $schema;
}
/**
* {@inheritdoc}
*/
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
// @todo Expand this in https://www.drupal.org/node/2912331.
$values['section'] = new Section('layout_onecol');
return $values;
}
/**
* {@inheritdoc}
*/
public function isEmpty() {
return empty($this->section);
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.