Drupal 8  8.0.2
LanguageItem Class Reference
Inheritance diagram for LanguageItem:

Public Member Functions

 setValue ($values, $notify=TRUE)
 
 applyDefaultValue ($notify=TRUE)
 
 onChange ($property_name, $notify=TRUE)
 
- 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 propertyDefinitions (FieldStorageDefinitionInterface $field_definition)
 
static getAllowedLanguageCodes ()
 
static schema (FieldStorageDefinitionInterface $field_definition)
 
- 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 'language' entity field item.

( id = "language", label = ("Language"), description = ("An entity field referencing a language."), default_widget = "language_select", default_formatter = "language", no_ui = TRUE, constraints = { "ComplexData" = { "value" = { "Length" = {"max" = 12}, "AllowedValues" = {"callback" = "\Drupal\Core\Field\Plugin\Field\FieldType\LanguageItem::getAllowedLanguageCodes" } } } } )

Todo:
Define the AllowedValues constraint via an options provider once https://www.drupal.org/node/2329937 is completed.

Member Function Documentation

applyDefaultValue (   $notify = TRUE)

{Applies the default value.

Parameters
bool$notify(optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Returns
Returns itself to allow for chaining.
}

Implements TypedDataInterface.

References Drupal\languageManager(), and LanguageItem\setValue().

Here is the call graph for this function:

static getAllowedLanguageCodes ( )
static

Defines allowed language codes for the field's AllowedValues constraint.

Returns
string[] The allowed values.

References Drupal\languageManager(), and LanguageInterface\STATE_ALL.

Here is the call graph for this function:

onChange (   $property_name,
  $notify = TRUE 
)

{}

References FieldItemBase\writePropertyValue().

Here is the call graph for this function:

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(), DataReferenceDefinition\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.

Referenced by EntityViewsDataTest\setupFieldStorageDefinition().

Here is the caller graph for this function:

setValue (   $values,
  $notify = TRUE 
)

{Sets the data value.

Parameters
mixed | null$valueThe value to set in the format as documented for the data type or NULL to unset the data value.
bool$notify(optional) Whether to notify the parent object of the change. Defaults to TRUE. If a property is updated from a parent object, set it to FALSE to avoid being notified again.
Exceptions
\InvalidArgumentExceptionIf the value input is inappropriate.
\Drupal\Core\TypedData\Exception\ReadOnlyExceptionIf the data is read-only.
}

Implements TypedDataInterface.

References Map\set().

Referenced by DefaultLanguageItem\applyDefaultValue(), and LanguageItem\applyDefaultValue().

Here is the call graph for this function:

Here is the caller graph for this function:


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