diff --git a/src/Plugin/views/exposed_form/VeflBasic.php b/src/Plugin/views/exposed_form/VeflBasic.php
index 8d1f08f..f911098 100644
--- a/src/Plugin/views/exposed_form/VeflBasic.php
+++ b/src/Plugin/views/exposed_form/VeflBasic.php
@@ -24,13 +24,13 @@ class VeflBasic extends Basic {
*/
protected function defineOptions() {
$options = parent::defineOptions();
- $options['layout'] = array(
- 'contains' => array(
- 'layout_id' => array('default' => 'vefl_onecol'),
- 'regions' => array('default' => array()),
- 'widget_region' => array('default' => array()),
- ),
- );
+ $options['layout'] = [
+ 'contains' => [
+ 'layout_id' => ['default' => 'vefl_onecol'],
+ 'regions' => ['default' => []],
+ 'widget_region' => ['default' => []],
+ ],
+ ];
return $options;
}
@@ -44,23 +44,23 @@ class VeflBasic extends Basic {
$layouts = Vefl::getLayouts();
// Outputs layout selectbox.
- $form['layout'] = array(
+ $form['layout'] = [
'#type' => 'details',
'#title' => $this->t('Layout settings'),
- );
- $form['layout']['layout_id'] = array(
+ ];
+ $form['layout']['layout_id'] = [
'#prefix' => '
',
'#type' => 'select',
'#options' => Vefl::getLayoutOptions($layouts),
'#title' => t('Layout'),
'#default_value' => $layout_id,
- );
- $form['layout']['change'] = array(
+ ];
+ $form['layout']['change'] = [
'#type' => 'submit',
'#value' => t('Change'),
- '#submit' => array(array($this, 'updateRegions')),
+ '#submit' => [[$this, 'updateRegions']],
'#suffix' => '
',
- );
+ ];
$form['layout']['widget_region'] = VeflBasic::getRegionElements($layout_id, $layouts);
}
@@ -69,24 +69,24 @@ class VeflBasic extends Basic {
* @param array $layouts
* @return array
*/
- private function getRegionElements($layout_id, $layouts = array()) {
+ private function getRegionElements($layout_id, $layouts = []) {
- $element = array(
+ $element = [
'#prefix' => '',
'#suffix' => '
',
- );
+ ];
// Outputs regions selectbox for each filter.
- $types = array(
+ $types = [
'filters' => $this->view->display_handler->getHandlers('filter'),
'actions' => Vefl::getFormActions(),
- );
+ ];
// Adds additional action for BEF combined sort. @todo
// if (!empty($vars['widgets']['sort-sort_bef_combine'])) {
// $actions[] = 'sort-sort_bef_combine';
// }
- $regions = array();
+ $regions = [];
foreach ($layouts[$layout_id]['regions'] as $region_id => $region) {
$regions[$region_id] = $region['label'];
}
@@ -99,11 +99,11 @@ class VeflBasic extends Basic {
$filter = $filter->definition['title'];
}
- $element[$id] = array(
+ $element[$id] = [
'#type' => 'select',
'#title' => $filter,
'#options' => $regions,
- );
+ ];
// Set default region for chosen layout.
if (!empty($this->options['layout']['widget_region'][$id]) && !empty($regions[$this->options['layout']['widget_region'][$id]])) {
diff --git a/src/Vefl.php b/src/Vefl.php
index 24c1f74..523adf6 100644
--- a/src/Vefl.php
+++ b/src/Vefl.php
@@ -25,13 +25,13 @@ class Vefl {
/**
* Gets Display Suite layouts.
*/
- public static function getLayoutOptions($layouts = array()) {
+ public static function getLayoutOptions($layouts = []) {
if (empty($layouts)) {
$layouts = Vefl::getLayouts();
}
// Converts layouts array to options.
- $layout_options = array();
+ $layout_options = [];
foreach ($layouts as $key => $layout_definition) {
$optgroup = t('Other');
@@ -41,7 +41,7 @@ class Vefl {
}
if (!isset($layout_options[$optgroup])) {
- $layout_options[$optgroup] = array();
+ $layout_options[$optgroup] = [];
}
// Stack the layout.
@@ -59,14 +59,14 @@ class Vefl {
* Returns action fields for views exposed form.
*/
public static function getFormActions() {
- $actions = array(
+ $actions = [
'sort_by' => t('Sort by'),
'sort_order' => t('Sort order'),
'items_per_page' => t('Items per page'),
'offset' => t('Offset'),
'submit' => t('Submit button'),
'reset' => t('Reset button'),
- );
+ ];
return $actions;
}
}
diff --git a/vefl.module b/vefl.module
index f33c15e..d0365d6 100644
--- a/vefl.module
+++ b/vefl.module
@@ -11,11 +11,11 @@ use Drupal\layout_plugin\Layout;
* Implements hook_theme().
*/
function vefl_theme() {
- $hooks = array();
- $hooks['vefl_views_exposed_form'] = array(
+ $hooks = [];
+ $hooks['vefl_views_exposed_form'] = [
'render element' => 'form',
'theme path' => drupal_get_path('module', 'vefl'),
- );
+ ];
return $hooks;
}
@@ -25,7 +25,7 @@ function vefl_theme() {
function vefl_theme_registry_alter(&$theme_registry) {
// Inserts default views preprocess function before vefl preprocess function.
$before = array_search('template_preprocess_vefl_views_exposed_form', $theme_registry['vefl_views_exposed_form']['preprocess functions']);
- array_splice($theme_registry['vefl_views_exposed_form']['preprocess functions'], $before, 0, array('template_preprocess_views_exposed_form'));
+ array_splice($theme_registry['vefl_views_exposed_form']['preprocess functions'], $before, 0, ['template_preprocess_views_exposed_form']);
}
/**