You are here

function domain_source_form_devel_generate_form_content_alter in Domain Access 8

Implements hook_form_FORM_ID_alter().

Add options for domain source when using Devel Generate.

File

domain_source/domain_source.module, line 238
Domain-based path rewrites for content.

Code

function domain_source_form_devel_generate_form_content_alter(&$form, &$form_state, $form_id) {

  // Add our element to the Devel generate form.
  $list = [
    '_derive' => t('Derive from domain selection'),
  ];
  $list += \Drupal::entityTypeManager()
    ->getStorage('domain')
    ->loadOptionsList();
  $form['domain_source'] = [
    '#title' => t('Domain source'),
    '#type' => 'checkboxes',
    '#options' => $list,
    '#weight' => 4,
    '#multiple' => TRUE,
    '#size' => count($list) > 5 ? 5 : count($list),
    '#default_value' => [
      '_derive',
    ],
    '#description' => t('Sets the source domain for created nodes.'),
  ];
}