public function ParagraphEditForm::form in Paragraphs Edit 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/
ParagraphEditForm.php, line 13
Class
Namespace
Drupal\paragraphs_editCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$route_match = $this
->getRouteMatch();
/** @var \Drupal\node\NodeInterface $node */
$node = $route_match
->getParameter('node');
$field_name = $route_match
->getParameter('field');
$field = $node
->get($field_name);
$field_definition = $field
->getFieldDefinition();
$field_label = $field_definition
->getLabel();
$delta = $route_match
->getParameter('delta');
$form['#title'] = $this
->t('Edit #@delta of @field of %label', [
'@delta' => $delta,
'@field' => $field_label,
'%label' => $node
->label(),
]);
return $form;
}