public function ParagraphEditForm::form in Paragraphs table 8
Gets the actual form array to be built.
Overrides ContentEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ ParagraphEditForm.php, line 46
Class
- ParagraphEditForm
- Paragraph Edit Form class.
Namespace
Drupal\paragraphs_table\FormCode
public function form(array $form, FormStateInterface $form_state) {
$field_name = $this->entity
->get('parent_field_name')->value;
$host = $this->entity
->getParentEntity();
$entity_type = $host
->getEntityTypeId();
$bundle = $host
->bundle();
$entityFieldManager = \Drupal::service('entity_field.manager')
->getFieldDefinitions($entity_type, $bundle);
$form['#title'] = $this
->t('Edit %type item %id', [
'%type' => $entityFieldManager[$field_name]
->getLabel(),
'%id' => $this->entity
->id(),
]);
$form = parent::form($form, $form_state);
return $form;
}