Drupal 8  8.0.2
TestItem Class Reference
Inheritance diagram for TestItem:

Public Member Functions

 storageSettingsForm (array &$form, FormStateInterface $form_state, $has_data)
 
 fieldSettingsForm (array $form, FormStateInterface $form_state)
 
 delete ()
 
 getConstraints ()
 
 isEmpty ()
 
- Public Member Functions inherited from FieldItemBase
 __construct (DataDefinitionInterface $definition, $name=NULL, TypedDataInterface $parent=NULL)
 
 getEntity ()
 
 getLangcode ()
 
 getFieldDefinition ()
 
 setValue ($values, $notify=TRUE)
 
 __get ($name)
 
 __set ($name, $value)
 
 __isset ($name)
 
 __unset ($name)
 
 view ($display_options=array())
 
 preSave ()
 
 postSave ($update)
 
 delete ()
 
 deleteRevision ()
 
 storageSettingsForm (array &$form, FormStateInterface $form_state, $has_data)
 
 fieldSettingsForm (array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from Map
 getValue ()
 
 setValue ($values, $notify=TRUE)
 
 getString ()
 
 get ($property_name)
 
 set ($property_name, $value, $notify=TRUE)
 
 getProperties ($include_computed=FALSE)
 
 toArray ()
 
 getIterator ()
 
 isEmpty ()
 
 __clone ()
 
 onChange ($property_name, $notify=TRUE)
 
 applyDefaultValue ($notify=TRUE)
 
- Public Member Functions inherited from TypedData
 __construct ($definition, $name=NULL, TypedDataInterface $parent=NULL)
 
 getPluginId ()
 
 getPluginDefinition ()
 
 getDataDefinition ()
 
 getValue ()
 
 setValue ($value, $notify=TRUE)
 
 getString ()
 
 getConstraints ()
 
 validate ()
 
 applyDefaultValue ($notify=TRUE)
 
 setContext ($name=NULL, TraversableTypedDataInterface $parent=NULL)
 
 getName ()
 
 getRoot ()
 
 getPropertyPath ()
 
 getParent ()
 
- Public Member Functions inherited from TraversableTypedDataInterface
 onChange ($name)
 

Static Public Member Functions

static defaultStorageSettings ()
 
static defaultFieldSettings ()
 
static propertyDefinitions (FieldStorageDefinitionInterface $field_definition)
 
static schema (FieldStorageDefinitionInterface $field_definition)
 
static storageSettingsToConfigData (array $settings)
 
static storageSettingsFromConfigData (array $settings)
 
static fieldSettingsToConfigData (array $settings)
 
static fieldSettingsFromConfigData (array $settings)
 
- Static Public Member Functions inherited from FieldItemBase
static defaultStorageSettings ()
 
static defaultFieldSettings ()
 
static mainPropertyName ()
 
static generateSampleValue (FieldDefinitionInterface $field_definition)
 
static storageSettingsToConfigData (array $settings)
 
static storageSettingsFromConfigData (array $settings)
 
static fieldSettingsToConfigData (array $settings)
 
static fieldSettingsFromConfigData (array $settings)
 
static calculateDependencies (FieldDefinitionInterface $field_definition)
 
static calculateStorageDependencies (FieldStorageDefinitionInterface $field_definition)
 
static onDependencyRemoval (FieldDefinitionInterface $field_definition, array $dependencies)
 
- Static Public Member Functions inherited from TypedData
static createInstance ($definition, $name=NULL, TraversableTypedDataInterface $parent=NULL)
 

Additional Inherited Members

- Protected Member Functions inherited from FieldItemBase
 getSettings ()
 
 getSetting ($setting_name)
 
 writePropertyValue ($property_name, $value)
 
- Protected Member Functions inherited from Map
 writePropertyValue ($property_name, $value)
 
- Protected Attributes inherited from Map
 $definition
 
 $values = array()
 
 $properties = array()
 
- Protected Attributes inherited from TypedData
 $definition
 
 $name
 
 $parent
 

Detailed Description

Defines the 'test_field' entity field item.

( id = "test_field", label = ("Test field"), description = ("Dummy field type used for tests."), default_widget = "test_field_widget", default_formatter = "field_test_default" )

Member Function Documentation

static defaultFieldSettings ( )
static

{Defines the field-level settings for this plugin.

Returns
array A list of default settings, keyed by the setting name.
}

Implements FieldItemInterface.

static defaultStorageSettings ( )
static

{Defines the storage-level settings for this plugin.

Returns
array A list of default settings, keyed by the setting name.
}

Implements FieldItemInterface.

delete ( )

{Defines custom delete behavior for field values.This method is called during the process of deleting an entity, just before values are deleted from storage.}

Implements FieldItemInterface.

References FieldItemBase\getEntity().

Here is the call graph for this function:

fieldSettingsForm ( array  $form,
FormStateInterface  $form_state 
)

{Returns a form for the field-level settings.Invoked from to allow administrators to configure field-level settings.

Parameters
array$formThe form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state of the (entire) configuration form.
Returns
array The form definition for the field settings.
}

Implements FieldItemInterface.

References FieldItemBase\getSetting(), and t().

Here is the call graph for this function:

static fieldSettingsFromConfigData ( array  $settings)
static

{Returns a settings array in the field type's canonical representation.This function does the inverse of static::fieldSettingsToConfigData(). It's called when loading a field's settings from a configuration object.

Parameters
array$settingsThe field's settings, as it is stored within a configuration object.
Returns
array The field settings, in the representation expected by the field type and code that interacts with it.
See Also
::fieldSettingsToConfigData()
}

Implements FieldItemInterface.

static fieldSettingsToConfigData ( array  $settings)
static

{Returns a settings array that can be stored as a configuration value.Same as static::storageSettingsToConfigData(), but for the field's settings.

Parameters
array$settingsThe field's settings in the field type's canonical representation.
Returns
array An array (either the unmodified $settings or a modified representation) that is suitable for storing as a deployable configuration value.
See Also
::storageSettingsToConfigData()
}

Implements FieldItemInterface.

getConstraints ( )

{Gets a list of validation constraints.

Returns
array Array of constraints, each being an instance of .
}

Implements TypedDataInterface.

References FieldItemBase\getFieldDefinition(), t(), and Drupal\typedDataManager().

Here is the call graph for this function:

isEmpty ( )

{Determines whether the data structure is empty.

Returns
bool TRUE if the data structure is empty, FALSE otherwise.
}

Implements ComplexDataInterface.

static propertyDefinitions ( FieldStorageDefinitionInterface  $field_definition)
static

{Defines field item properties.Properties that are required to constitute a valid, non-empty item should be denoted with ::setRequired().

Returns
[] An array of property definitions of contained properties, keyed by property name.
See Also
}

Implements FieldItemInterface.

References DataDefinition\create(), and t().

Here is the call graph for this function:

static schema ( FieldStorageDefinitionInterface  $field_definition)
static

{Returns the schema for the field.This method is static because the field schema information is needed on creation of the field. FieldItemInterface objects instantiated at that time are not reliable as field settings might be missing.Computed fields having no schema should return an empty array.

Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface$field_definitionThe field definition.
Returns
array An empty array if there is no schema, or an associative array with the following key/value pairs:
  • columns: An array of Schema API column specifications, keyed by column name. The columns need to be a subset of the properties defined in propertyDefinitions(). The 'not null' property is ignored if present, as it is determined automatically by the storage controller depending on the table layout and the property definitions. It is recommended to avoid having the column definitions depend on field settings when possible. No assumptions should be made on how storage engines internally use the original column name to structure their storage.
  • unique keys: (optional) An array of Schema API unique key definitions. Only columns that appear in the 'columns' array are allowed.
  • indexes: (optional) An array of Schema API index definitions. Only columns that appear in the 'columns' array are allowed. Those indexes will be used as default indexes. Field definitions can specify additional indexes or, at their own risk, modify the default indexes specified by the field-type module. Some storage engines might not support indexes.
  • foreign keys: (optional) An array of Schema API foreign key definitions. Note, however, that the field data is not necessarily stored in SQL. Also, the possible usage is limited, as you cannot specify another field as related, only existing SQL tables, such as {taxonomy_term_data}.
}

Implements FieldItemInterface.

storageSettingsForm ( array &  $form,
FormStateInterface  $form_state,
  $has_data 
)

{Returns a form for the storage-level settings.Invoked from to allow administrators to configure storage-level settings.Field storage might reject settings changes that affect the field storage schema if the storage already has data. When the $has_data parameter is TRUE, the form should not allow changing the settings that take part in the schema() method. It is recommended to set #access to FALSE on the corresponding elements.

Parameters
array$formThe form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface$form_stateThe form state of the (entire) configuration form.
bool$has_dataTRUE if the field already has data, FALSE if not.
Returns
The form definition for the field settings.
}

Implements FieldItemInterface.

References FieldItemBase\getSetting(), and t().

Here is the call graph for this function:

static storageSettingsFromConfigData ( array  $settings)
static

{Returns a settings array in the field type's canonical representation.This function does the inverse of static::storageSettingsToConfigData(). It's called when loading a field's settings from a configuration object.

Parameters
array$settingsThe field's settings, as it is stored within a configuration object.
Returns
array The settings, in the representation expected by the field type and code that interacts with it.
See Also
::storageSettingsToConfigData()
}

Implements FieldItemInterface.

static storageSettingsToConfigData ( array  $settings)
static

{Returns a settings array that can be stored as a configuration value.For all use cases where field settings are stored and managed as configuration, this method is used to map from the field type's representation of its settings to a representation compatible with deployable configuration. This includes:

  • Array keys at any depth must not contain a ".".
  • Ideally, array keys at any depth are either numeric or can be enumerated as a "mapping" within the configuration schema. While not strictly required, this simplifies configuration translation UIs, configuration migrations between Drupal versions, and other use cases.
  • To support configuration deployments, references to content entities must use UUIDs rather than local IDs.
An example of a conversion between representations might be an "allowed_values" setting that's structured by the field type as a ::getPossibleOptions() result (i.e., values as keys and labels as values). For such a use case, in order to comply with the above, this method could convert that representation to a numerically indexed array whose values are sub-arrays with the schema definable keys of "value" and "label".
Parameters
array$settingsThe field's settings in the field type's canonical representation.
Returns
array An array (either the unmodified $settings or a modified representation) that is suitable for storing as a deployable configuration value.
See Also
::set()
}

Implements FieldItemInterface.


The documentation for this class was generated from the following file: