function ShapeItem::schema
Same name in other branches
- 9 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::schema()
- 8.9.x core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::schema()
- 10 core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ShapeItem.php \Drupal\entity_test\Plugin\Field\FieldType\ShapeItem::schema()
Overrides FieldItemInterface::schema
File
-
core/
modules/ system/ tests/ modules/ entity_test/ src/ Plugin/ Field/ FieldType/ ShapeItem.php, line 48
Class
- ShapeItem
- Defines the 'shape' field type.
Namespace
Drupal\entity_test\Plugin\Field\FieldTypeCode
public static function schema(FieldStorageDefinitionInterface $field_definition) {
$foreign_keys = [];
// The 'foreign keys' key is not always used in tests.
if ($field_definition->getSetting('foreign_key_name')) {
$foreign_keys['foreign keys'] = [
// This is a dummy foreign key definition, references a table that
// doesn't exist, but that's not a problem.
$field_definition->getSetting('foreign_key_name') => [
'table' => $field_definition->getSetting('foreign_key_name'),
'columns' => [
$field_definition->getSetting('foreign_key_name') => 'id',
],
],
];
}
return [
'columns' => [
'shape' => [
'type' => 'varchar',
'length' => 32,
],
'color' => [
'type' => 'varchar',
'length' => 32,
],
],
] + $foreign_keys;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.