public function EntityFields::hideField in Simplifying 8
Hide entity form field.
1 call to EntityFields::hideField()
- EntityFields::hideFields in src/
Services/ EntityFields.php - Hide entity form fields.
File
- src/
Services/ EntityFields.php, line 94
Class
- EntityFields
- Class EntityFields.
Namespace
Drupal\simplifying\ServicesCode
public function hideField(&$form, $field) {
// Alter to change the list of content fields to be hidden.
$this->modulehandler
->alter('simplifying_hide_field', $form, $field);
if (!isset($form[$field]) && $field != 'format') {
return;
}
if ($field == 'format') {
$this
->hideTextFormatElements($form);
}
elseif ($field == 'path' || $field == 'comment') {
$form[$field]['widget'][0]['#prefix'] = '<div class="hidden">';
$form[$field]['widget'][0]['#suffix'] = '</div>';
}
else {
$form[$field]['#prefix'] = '<div class="hidden">';
$form[$field]['#suffix'] = '</div>';
}
}