Drupal 8  8.0.2
FieldStorageAddForm Class Reference
Inheritance diagram for FieldStorageAddForm:

Public Member Functions

 __construct (EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_plugin_manager, QueryFactory $query_factory, ConfigFactoryInterface $config_factory)
 
 getFormId ()
 
 buildForm (array $form, FormStateInterface $form_state, $entity_type_id=NULL, $bundle=NULL)
 
 validateForm (array &$form, FormStateInterface $form_state)
 
 submitForm (array &$form, FormStateInterface $form_state)
 
 fieldNameExists ($value, $element, FormStateInterface $form_state)
 

Static Public Member Functions

static create (ContainerInterface $container)
 

Data Fields

 $queryFactory
 

Protected Member Functions

 validateAddNew (array $form, FormStateInterface $form_state)
 
 validateAddExisting (array $form, FormStateInterface $form_state)
 
 configureEntityFormDisplay ($field_name, $widget_id=NULL)
 
 configureEntityViewDisplay ($field_name, $formatter_id=NULL)
 
 getExistingFieldStorageOptions ()
 
 getExistingFieldLabels (array $field_names)
 

Protected Attributes

 $entityTypeId
 
 $bundle
 
 $entityManager
 
 $fieldTypePluginManager
 
 $configFactory
 

Detailed Description

Provides a form for the "field storage" add page.

Constructor & Destructor Documentation

__construct ( EntityManagerInterface  $entity_manager,
FieldTypePluginManagerInterface  $field_type_plugin_manager,
QueryFactory  $query_factory,
ConfigFactoryInterface  $config_factory 
)

Constructs a new FieldStorageAddForm object.

Parameters
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.
\Drupal\Core\Field\FieldTypePluginManagerInterface$field_type_plugin_managerThe field type plugin manager.
\Drupal\Core\Entity\Query\QueryFactory$query_factoryThe entity query factory.
\Drupal\Core\Config\ConfigFactoryInterface$config_factoryThe configuration factory.

References Drupal\configFactory(), and Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

buildForm ( array  $form,
FormStateInterface  $form_state,
  $entity_type_id = NULL,
  $bundle = NULL 
)

{}

References Drupal\config(), FormStateInterface\get(), FieldStorageAddForm\getExistingFieldLabels(), FieldStorageAddForm\getExistingFieldStorageOptions(), FieldStorageConfig\NAME_MAX_LENGTH, FormStateInterface\set(), and t().

Here is the call graph for this function:

configureEntityFormDisplay (   $field_name,
  $widget_id = NULL 
)
protected

Configures the newly created field for the default view and form modes.

Parameters
string$field_nameThe field name.
string | null$widget_id(optional) The plugin ID of the widget. Defaults to NULL.

Referenced by FieldStorageAddForm\submitForm().

Here is the caller graph for this function:

configureEntityViewDisplay (   $field_name,
  $formatter_id = NULL 
)
protected

Configures the newly created field for the default view and form modes.

Parameters
string$field_nameThe field name.
string | null$formatter_id(optional) The plugin ID of the formatter. Defaults to NULL.

Referenced by FieldStorageAddForm\submitForm().

Here is the caller graph for this function:

static create ( ContainerInterface  $container)
static

{}

fieldNameExists (   $value,
  $element,
FormStateInterface  $form_state 
)

Checks if a field machine name is taken.

Parameters
string$valueThe machine name, not prefixed.
array$elementAn array containing the structure of the 'field_name' element.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
bool Whether or not the field machine name is taken.

References Drupal\configFactory(), Drupal\entityManager(), and FormStateInterface\getValue().

Here is the call graph for this function:

getExistingFieldLabels ( array  $field_names)
protected

Gets the human-readable labels for the given field storage names.

Since not all field storages are required to have a field, we can only provide the field labels on a best-effort basis (e.g. the label of a field storage without any field attached to a bundle will be the field name).

Parameters
array$field_namesAn array of field names.
Returns
array An array of field labels keyed by field name.

References Drupal\entityManager().

Referenced by FieldStorageAddForm\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

getExistingFieldStorageOptions ( )
protected

Returns an array of existing field storages that can be added to a bundle.

Returns
array An array of existing field storages keyed by name.

References Drupal\entityManager(), FieldStorageConfigInterface\isLocked(), and t().

Referenced by FieldStorageAddForm\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

getFormId ( )

{}

submitForm ( array &  $form,
FormStateInterface  $form_state 
)
validateAddExisting ( array  $form,
FormStateInterface  $form_state 
)
protected

Validates the 're-use existing field' case.

Parameters
array$formAn associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
See Also
::validateForm()

References FormStateInterface\getValue(), FormStateInterface\setErrorByName(), and t().

Referenced by FieldStorageAddForm\validateForm().

Here is the call graph for this function:

Here is the caller graph for this function:

validateAddNew ( array  $form,
FormStateInterface  $form_state 
)
protected

Validates the 'add new field' case.

Parameters
array$formAn associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
See Also
::validateForm()

References Drupal\configFactory(), FormStateInterface\getValue(), FormStateInterface\setErrorByName(), FormStateInterface\setValueForElement(), and t().

Referenced by FieldStorageAddForm\validateForm().

Here is the call graph for this function:

Here is the caller graph for this function:

validateForm ( array &  $form,
FormStateInterface  $form_state 
)

{}

References FormStateInterface\getValue(), FormStateInterface\setErrorByName(), t(), FieldStorageAddForm\validateAddExisting(), and FieldStorageAddForm\validateAddNew().

Here is the call graph for this function:


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