SectionData
class SectionData extends TypedData (View source)
| internal | Plugin classes are internal. |
Provides a data type wrapping \Drupal\layout_builder\Section.
Traits
Provides dependency injection friendly methods for serialization.
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Wrapper methods for classes that needs typed data manager object.
Properties
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected TypedDataManagerInterface | $typedDataManager | The typed data manager used for creating the data types. |
from TypedDataTrait |
| protected DataDefinitionInterface | $definition | The data definition. |
from TypedData |
| protected string | $name | The property name. |
from TypedData |
| protected TraversableTypedDataInterface|null | $parent | The parent typed data object. |
from TypedData |
| protected Section | $value | The section object. |
Methods
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Constructs a TypedData object given its definition and context.
Constructs a TypedData object given its definition and context.
Sets the data value.
Sets the context of a property or item via a context aware parent.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
$this
setTypedDataManager(TypedDataManagerInterface $typed_data_manager)
Sets the typed data manager.
TypedDataManagerInterface
getTypedDataManager()
Gets the typed data manager.
static
createInstance(DataDefinitionInterface $definition, string|null $name = NULL, TraversableTypedDataInterface $parent = NULL)
Constructs a TypedData object given its definition and context.
__construct(DataDefinitionInterface $definition, string $name = NULL, TypedDataInterface $parent = NULL)
Constructs a TypedData object given its definition and context.
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
DataDefinitionInterface
getDataDefinition()
Gets the data definition.
mixed
getValue()
Gets the data value.
setValue(mixed|null $value, bool $notify = TRUE)
Sets the data value.
string
getString()
Returns a string representation of the data.
array
getConstraints()
Gets a list of validation constraints.
ConstraintViolationListInterface
validate()
Validates the currently set data value.
$this
applyDefaultValue(bool $notify = TRUE)
Applies the default value.
setContext(string|null $name = NULL, TraversableTypedDataInterface $parent = NULL)
Sets the context of a property or item via a context aware parent.
This method is supposed to be called by the factory only.
string|int|null
getName()
Returns the name of a property or item.
TraversableTypedDataInterface
getRoot()
Returns the root of the typed data tree.
Returns the root data for a tree of typed data objects; e.g. for an entity field item the root of the tree is its parent entity object.
string
getPropertyPath()
Returns the property path of the data.
The trail of property names relative to the root of the typed data tree, separated by dots; e.g. 'field_text.0.format'.
TraversableTypedDataInterface|null
getParent()
Returns the parent data structure; i.e. either complex data or a list.