public function EntityFields::formFields in Simplifying 8
Get settings entity form fields.
File
- src/
Services/ EntityFields.php, line 50
Class
- EntityFields
- Class EntityFields.
Namespace
Drupal\simplifying\ServicesCode
public function formFields(&$form, $form_state) {
$types = [
'nodes' => $this
->t('Node fields'),
'users' => $this
->t('User fields'),
'comments' => $this
->t('Comment fields'),
'taxonomy' => $this
->t('Taxonomy fields'),
'blocks' => $this
->t('Block fields'),
];
foreach ($types as $type => $label) {
$form[$type . '_wrapper'] = [
'#type' => 'details',
'#title' => $label,
'#group' => 'tabs',
];
$form[$type . '_wrapper'][$type . '_fields'] = [
'#type' => 'checkboxes',
'#title' => $label,
'#title_display' => 'invisible',
'#parents' => [
'entity_fields',
$type,
],
'#options' => $this
->getDefaultFields($type),
'#default_value' => $this
->getFields($type),
];
}
}