You are here

function purl_form_menu_edit_form_alter in Persistent URL 8

File

./purl.module, line 9

Code

function purl_form_menu_edit_form_alter(&$form, $form_state) {

  // Edit menu as whole
  //
  $providerManager = \Drupal::getContainer()
    ->get('purl.plugin.provider_manager');
  $definitions = $providerManager
    ->findDefinitions();
  $active = [
    null => '-- None --',
  ];
  foreach ($definitions as $id => $def) {
    if (!$def['method']) {
      continue;
    }
    $active[$id] = $def['name'];
  }
  $form['purl'] = [
    '#tree' => true,
    '#type' => 'fieldset',
    '#title' => 'Persistent URLs',
    '#collapsible' => false,
    '#collapsed' => false,
  ];
  $form['purl']['purl_provider'] = array(
    '#type' => 'select',
    '#title' => 'PURL provider',
    '#value' => null,
    '#options' => $active,
  );
}