public function EntityBlockWidget::processForm in Entityblock 8
Process callback: add title field class to copy the title from.
See also
\Drupal\Core\Entity\Entity\EntityFormDisplay::buildForm()
File
- src/
Plugin/ Field/ FieldWidget/ EntityBlockWidget.php, line 218 - Contains \Drupal\entityblock\Plugin\Field\FieldWidget\EntityBlockWidget.
Class
- EntityBlockWidget
- Plugin implementation of the 'EntityBlock' widget.
Namespace
Drupal\entityblock\Plugin\Field\FieldWidgetCode
public function processForm($element, FormStateInterface $form_state, $form) {
$element_title_key = \Drupal::entityTypeManager()
->getDefinition($this->fieldDefinition
->getTargetEntityTypeId())
->getKey('label');
if (!empty($form[$element_title_key])) {
$element[$element_title_key]['#attributes']['class'][] = 'entity-title-field';
}
return $element;
}