class FieldNote
Same name in other branches
- 3.x modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php \Drupal\field_permission_example\Plugin\Field\FieldType\FieldNote
- 4.0.x modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php \Drupal\field_permission_example\Plugin\Field\FieldType\FieldNote
Plugin implementation of the 'field_permission_example' field type.
Plugin annotation
@FieldType(
id = "field_permission_example_fieldnote",
label = @Translation("Example FieldNote"),
module = "field_permission_example",
description = @Translation("Demonstrates a field simple field note type with permission-based access control."),
default_widget = "field_permission_example_widget",
default_formatter = "field_permission_example_simple_formatter"
)
Hierarchy
- class \Drupal\field_permission_example\Plugin\Field\FieldType\FieldNote extends \Drupal\Core\Field\FieldItemBase
Expanded class hierarchy of FieldNote
File
-
field_permission_example/
src/ Plugin/ Field/ FieldType/ FieldNote.php, line 21
Namespace
Drupal\field_permission_example\Plugin\Field\FieldTypeView source
class FieldNote extends FieldItemBase {
/**
* {@inheritdoc}
*/
public static function schema(FieldStorageDefinitionInterface $field_definition) {
return [
'columns' => [
'value' => [
'type' => 'text',
'size' => 'normal',
'not null' => FALSE,
],
],
];
}
/**
* {@inheritdoc}
*/
public function isEmpty() {
$value = $this->get('value')
->getValue();
return $value === NULL || $value === '';
}
/**
* {@inheritdoc}
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string')->setLabel(t('Field Note'));
return $properties;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
FieldNote::isEmpty | public | function | |
FieldNote::propertyDefinitions | public static | function | |
FieldNote::schema | public static | function |