trait BricksFieldTypeTrait in Bricks 8
Hierarchy
- trait \Drupal\bricks\Plugin\Field\FieldType\BricksFieldTypeTrait
1 file declares its use of BricksFieldTypeTrait
- BricksTreeRevisionedItem.php in modules/
bricks_revisions/ src/ Plugin/ Field/ FieldType/ BricksTreeRevisionedItem.php
File
- src/
Plugin/ Field/ FieldType/ BricksFieldTypeTrait.php, line 8
Namespace
Drupal\bricks\Plugin\Field\FieldTypeView source
trait BricksFieldTypeTrait {
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
$schema = parent::schema($field_definition);
$schema['columns']['depth'] = [
'type' => 'int',
'size' => 'tiny',
'unsigned' => TRUE,
];
$schema['columns']['options'] = [
'type' => 'blob',
'size' => 'normal',
'not null' => FALSE,
'serialize' => TRUE,
];
return $schema;
}
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties = parent::propertyDefinitions($field_definition);
$properties['depth'] = DataDefinition::create('integer')
->setLabel(t('Depth'));
$properties['options'] = DataDefinition::create('any')
->setLabel(t('Options'));
return $properties;
}
/**
* {@inheritdoc}
*/
public static function getPreconfiguredOptions() {
$options = parent::getPreconfiguredOptions();
array_walk($options, function (array &$option) {
$option['label'] .= ' (bricks)';
});
return $options;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BricksFieldTypeTrait:: |
public static | function | ||
BricksFieldTypeTrait:: |
public static | function | ||
BricksFieldTypeTrait:: |
public static | function |