function micon_paragraphs_form_paragraphs_type_form_alter in Micon 8
Same name and namespace in other branches
- 2.x micon_paragraphs/micon_paragraphs.module \micon_paragraphs_form_paragraphs_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_paragraphs/
micon_paragraphs.module, line 20 - Contains micon_paragraphs.module.
Code
function micon_paragraphs_form_paragraphs_type_form_alter(&$form, FormStateInterface $form_state) {
/** @var \Drupal\paragraphs\ParagraphsTypeInterface $type */
$type = $form_state
->getFormObject()
->getEntity();
$form['icon'] = [
'#type' => 'micon',
'#title' => t('Icon'),
'#default_value' => micon_paragraphs_icon($type),
'#weight' => 0,
];
// Hide file upload.
$form['icon_file']['#access'] = FALSE;
$form['#entity_builders'][] = 'micon_paragraphs_form_node_type_form_builder';
}