You are here

function title_form_node_type_edit_form_alter in Title 8.2

Implements hook_form__FORM_ID_alter().

File

./title.module, line 21
Convert titles into fields which can be display manipulated.

Code

function title_form_node_type_edit_form_alter(&$form, FormStateInterface $form_state) {

  // Add additional settings to the node form using the 3rd party settings
  // interface. See title.schema.yml.
  $type = $form_state
    ->getFormObject()
    ->getEntity();
  $config_manager = \Drupal::service('title.config_manager');
  $form['title_settings'] = [
    '#title' => t('Title Settings'),
    '#group' => 'additional_settings',
    '#type' => 'details',
    'title_settings' => [
      'display_configurable_title' => [
        '#type' => 'checkbox',
        '#title' => t('Display Configurable Title'),
        '#description' => t('Allow the display of the node title to be configured on the "Manage Display" interface.'),
        '#default_value' => $config_manager
          ->getEnabled($type
          ->id()),
      ],
    ],
  ];
  $form['#entity_builders'][] = 'title_form_node_type_form_builder';
}