function micon_content_type_form_node_type_form_alter in Micon 8
Same name and namespace in other branches
- 2.x micon_content_type/micon_content_type.module \micon_content_type_form_node_type_form_alter()
Implements hook_form_FORM_ID_alter().
Adds icon options to the node type form.
See also
NodeTypeForm::form()
menu_ui_form_node_type_form_submit()
File
- micon_content_type/
micon_content_type.module, line 20 - Contains micon_content_type.module.
Code
function micon_content_type_form_node_type_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\node\NodeTypeInterface $type */
$type = $form_state
->getFormObject()
->getEntity();
$form['icon'] = [
'#type' => 'micon',
'#title' => t('Icon'),
'#default_value' => micon_content_type_icon($type),
'#weight' => 0,
];
$form['#entity_builders'][] = 'micon_content_type_form_node_type_form_builder';
}