config_views.module in Configuration Views 8
Same filename and directory in other branches
Contains Config Views implementation.
File
config_views.moduleView source
<?php
/**
* @file
* Contains Config Views implementation.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_FORM_ID_alter().
*/
function config_views_form_view_add_form_alter(&$form, FormStateInterface $form_state) {
$options = [];
foreach ($form['displays']['show']['wizard_key']['#options'] as $key => $option) {
$group = 'Content';
if (strpos($key, 'standard:') === 0 || strpos($key, 'config_views') === 0) {
$group = 'Configuration';
}
$options[$group][$key] = $option;
}
// Order by label, instead of key.
if (is_array($options['Content'])) {
uasort($options['Content'], function ($a, $b) {
return $a
->render() > $b
->render();
});
}
// Order by label, instead of key.
if (is_array($options['Content'])) {
uasort($options['Configuration'], function ($a, $b) {
return $a
->render() > $b
->render();
});
}
$form['displays']['show']['wizard_key']['#options'] = $options;
}
Functions
Name | Description |
---|---|
config_views_form_view_add_form_alter | Implements hook_form_FORM_ID_alter(). |