Drupal 8  8.0.2
ContentEntityForm Class Reference
Inheritance diagram for ContentEntityForm:

Public Member Functions

 __construct (EntityManagerInterface $entity_manager)
 
 form (array $form, FormStateInterface $form_state)
 
 submitForm (array &$form, FormStateInterface $form_state)
 
 getFormLangcode (FormStateInterface $form_state)
 
 isDefaultFormLangcode (FormStateInterface $form_state)
 
 getFormDisplay (FormStateInterface $form_state)
 
 setFormDisplay (EntityFormDisplayInterface $form_display, FormStateInterface $form_state)
 
 updateFormLangcode ($entity_type_id, EntityInterface $entity, array $form, FormStateInterface $form_state)
 
 updateChangedTime (EntityInterface $entity)
 
- Public Member Functions inherited from EntityForm
 setOperation ($operation)
 
 getBaseFormId ()
 
 getFormId ()
 
 buildForm (array $form, FormStateInterface $form_state)
 
 form (array $form, FormStateInterface $form_state)
 
 processForm ($element, FormStateInterface $form_state, $form)
 
 afterBuild (array $element, FormStateInterface $form_state)
 
 submitForm (array &$form, FormStateInterface $form_state)
 
 save (array $form, FormStateInterface $form_state)
 
 buildEntity (array $form, FormStateInterface $form_state)
 
 getEntity ()
 
 setEntity (EntityInterface $entity)
 
 getEntityFromRouteMatch (RouteMatchInterface $route_match, $entity_type_id)
 
 getOperation ()
 
 setModuleHandler (ModuleHandlerInterface $module_handler)
 
 setEntityManager (EntityManagerInterface $entity_manager)
 
 setEntityTypeManager (EntityTypeManagerInterface $entity_type_manager)
 
- Public Member Functions inherited from EntityFormInterface
 setStringTranslation (TranslationInterface $string_translation)
 
- Public Member Functions inherited from ContentEntityFormInterface
 validateForm (array &$form, FormStateInterface $form_state)
 

Static Public Member Functions

static create (ContainerInterface $container)
 

Protected Member Functions

 getEditedFieldNames (FormStateInterface $form_state)
 
 init (FormStateInterface $form_state)
 
 initFormLangcodes (FormStateInterface $form_state)
 
 copyFormValuesToEntity (EntityInterface $entity, array $form, FormStateInterface $form_state)
 
- Protected Member Functions inherited from EntityForm
 init (FormStateInterface $form_state)
 
 actionsElement (array $form, FormStateInterface $form_state)
 
 actions (array $form, FormStateInterface $form_state)
 
 copyFormValuesToEntity (EntityInterface $entity, array $form, FormStateInterface $form_state)
 
 prepareEntity ()
 
 prepareInvokeAll ($hook, FormStateInterface $form_state)
 

Protected Attributes

 $entityManager
 
- Protected Attributes inherited from EntityForm
 $operation
 
 $moduleHandler
 
 $entityManager
 
 $entityTypeManager
 
 $entity
 

Detailed Description

Entity form variant for content entity types.

See Also

Constructor & Destructor Documentation

__construct ( EntityManagerInterface  $entity_manager)

Constructs a ContentEntityForm object.

Parameters
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

copyFormValuesToEntity ( EntityInterface  $entity,
array  $form,
FormStateInterface  $form_state 
)
protected

{}

References ContentEntityForm\getFormDisplay(), and FormStateInterface\getValues().

Here is the call graph for this function:

static create ( ContainerInterface  $container)
static

{}

form ( array  $form,
FormStateInterface  $form_state 
)

{}

References ContentEntityForm\getFormDisplay().

Here is the call graph for this function:

getEditedFieldNames ( FormStateInterface  $form_state)
protected

Gets the names of all fields edited in the form.

If the entity form customly adds some fields to the form (i.e. without using the form display), it needs to add its fields here and override flagViolations() for displaying the violations.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
string[] An array of field names.

References ContentEntityForm\getFormDisplay().

Here is the call graph for this function:

getFormDisplay ( FormStateInterface  $form_state)

{Gets the form display.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
. The current form display.
}

Implements ContentEntityFormInterface.

References FormStateInterface\get().

Referenced by ContentEntityForm\copyFormValuesToEntity(), ContentEntityForm\form(), and ContentEntityForm\getEditedFieldNames().

Here is the call graph for this function:

Here is the caller graph for this function:

getFormLangcode ( FormStateInterface  $form_state)

{Gets the code identifying the active form language.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
string The form language code.
}

Implements ContentEntityFormInterface.

References FormStateInterface\get(), and ContentEntityForm\initFormLangcodes().

Referenced by ContentEntityForm\init().

Here is the call graph for this function:

Here is the caller graph for this function:

init ( FormStateInterface  $form_state)
protected

Initializes the form state and the entity before the first form build.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.

References EntityFormDisplay\collectRenderDisplay(), ContentEntityForm\getFormLangcode(), EntityForm\getOperation(), ContentEntityForm\initFormLangcodes(), and ContentEntityForm\setFormDisplay().

Here is the call graph for this function:

initFormLangcodes ( FormStateInterface  $form_state)
protected

Initializes form language code values.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.

References Drupal\entityManager(), FormStateInterface\has(), and FormStateInterface\set().

Referenced by ContentEntityForm\getFormLangcode(), ContentEntityForm\init(), and ContentEntityForm\isDefaultFormLangcode().

Here is the call graph for this function:

Here is the caller graph for this function:

isDefaultFormLangcode ( FormStateInterface  $form_state)

{Checks whether the current form language matches the entity one.

Parameters
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
bool Returns TRUE if the entity form language matches the entity one.
}

Implements ContentEntityFormInterface.

References FormStateInterface\get(), and ContentEntityForm\initFormLangcodes().

Referenced by ContentEntityForm\updateFormLangcode().

Here is the call graph for this function:

Here is the caller graph for this function:

setFormDisplay ( EntityFormDisplayInterface  $form_display,
FormStateInterface  $form_state 
)

{Sets the form display.Sets the form display which will be used for populating form element defaults.

Parameters
\Drupal\Core\Entity\Display\EntityFormDisplayInterface$form_displayThe form display that the current form operates with.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
$this
}

Implements ContentEntityFormInterface.

References FormStateInterface\set().

Referenced by ContentEntityForm\init().

Here is the call graph for this function:

Here is the caller graph for this function:

submitForm ( array &  $form,
FormStateInterface  $form_state 
)

{Form submission handler.

Parameters
array$formAn associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
}

Implements FormInterface.

References ContentEntityForm\updateChangedTime().

Here is the call graph for this function:

updateChangedTime ( EntityInterface  $entity)

Updates the changed time of the entity.

Applies only if the entity implements the EntityChangedInterface.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity updated with the submitted values.

References EntityInterface\getEntityType().

Referenced by ContentEntityForm\submitForm().

Here is the call graph for this function:

Here is the caller graph for this function:

updateFormLangcode (   $entity_type_id,
EntityInterface  $entity,
array  $form,
FormStateInterface  $form_state 
)

Updates the form language to reflect any change to the entity language.

There are use cases for modules to act both before and after form language being updated, thus the update is performed through an entity builder callback, which allows to support both cases.

Parameters
string$entity_type_idThe entity type identifier.
\Drupal\Core\Entity\EntityInterface$entityThe entity updated with the submitted values.
array$formThe complete form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
See Also
::form()

References ContentEntityForm\isDefaultFormLangcode(), EntityInterface\language(), and FormStateInterface\set().

Here is the call graph for this function:


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