Commit ab357e02 authored by NesleeCanilPinto's avatar NesleeCanilPinto Committed by Neslee
Browse files

Issue #3170659 by Neslee Canil Pinto: PHP Coding Standards

parent cfeb8064
......@@ -25,7 +25,13 @@ function better_exposed_filters_help($route_name, RouteMatchInterface $route_mat
$output .= '<p>' . t('Better Exposed Filters (BEF) modifies the use of Views by replacing the \'single\' or \'multi\' <em>select boxes</em> with <em>radio buttons or checkboxes</em>. Views offers the ability to expose filters to the end user. When you expose a filter, you allow the user to interact with the view making it easy to build an advanced search. Better Exposed Filters gives you greater control over the rendering of exposed filters. For more information, see the <a href=":online">online documentation for the Better Exposed Filters module</a>.', [':online' => 'https://www.drupal.org/node/766974']) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dt>' . t('Editing or Creating Views') . '</dt>';
$output .= '<dd>' . t('Better Exposed Filters is used on <a href=":views">Views</a> that use an exposed filter. Views filters are used to reduce the result set of a View to a manageable amount of data. BEF only operates on fields that have a limited number of options such as <a href=":node">Node</a>:Type or <a href=":taxonomy">Taxonomy</a>:TermID.', [':views' => Url::fromRoute('help.page', ['name' => 'views'])->toString(), ':node' => Url::fromRoute('help.page', ['name' => 'node'])->toString(), ':taxonomy' => (\Drupal::moduleHandler()->moduleExists('taxonomy')) ? Url::fromRoute('help.page', ['name' => 'taxonomy'])->toString() : '#']) . '</dd>';
$output .= '<dd>' . t('Better Exposed Filters is used on <a href=":views">Views</a> that use an exposed filter. Views filters are used to reduce the result set of a View to a manageable amount of data. BEF only operates on fields that have a limited number of options such as <a href=":node">Node</a>:Type or <a href=":taxonomy">Taxonomy</a>:TermID.',
[
':views' => Url::fromRoute('help.page',
['name' => 'views'])->toString(), ':node' => Url::fromRoute('help.page',
['name' => 'node'])->toString(), ':taxonomy' => (\Drupal::moduleHandler()->moduleExists('taxonomy')) ? Url::fromRoute('help.page',
['name' => 'taxonomy'])->toString() : '#',
]) . '</dd>';
$output .= '<dt>' . t('Styling Better Exposed Filters') . '</dt>';
$output .= '<dd>' . t('BEF provides some additional HTML structure to help you style your exposed filters. For some common examples see the <a href=":doco">online documentation</a>.', [':doco' => 'https://www.drupal.org/node/766974']) . '</dd>';
return $output;
......
......@@ -75,7 +75,7 @@ function better_exposed_filters_preprocess_views_exposed_form(array &$variables)
/******************************************************************************
* Preprocess functions for BEF themed elements.
******************************************************************************/
*/
/**
* Prepares variables for bef-checkboxes template.
......@@ -164,10 +164,10 @@ function template_preprocess_bef_hidden(array &$variables) {
// group heading. Otherwise, just add the element to the set.
// $element_set = array();
// if (is_array($elem)) {
// $element_set = $elem;
// $element_set = $elem;
// }
// else {
// $element_set[$option] = $elem;
// $element_set[$option] = $elem;
// }
}
......@@ -286,7 +286,7 @@ function template_preprocess_bef_links(array &$variables) {
/******************************************************************************
* Utility functions for BEF themed elements.
******************************************************************************/
*/
/**
* Internal function to handled nested form elements.
......
......@@ -2,8 +2,6 @@
namespace Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter;
use Drupal\Core\Form\FormStateInterface;
/**
* Default widget implementation.
*
......
......@@ -185,7 +185,8 @@ abstract class FilterWidgetBase extends BetterExposedFiltersWidgetBase implement
if ($this->configuration['advanced']['rewrite']['filter_rewrite_values']) {
$form[$field_id]['#options'] = BetterExposedFiltersHelper::rewriteOptions($form[$field_id]['#options'], $this->configuration['advanced']['rewrite']['filter_rewrite_values']);
// @todo what is $selected?
// if (isset($selected) && !isset($form[$field_id]['#options'][$selected])) {
// if (isset($selected) &&
// !isset($form[$field_id]['#options'][$selected])) {
// Avoid "Illegal choice" errors.
// $form[$field_id]['#default_value'] = NULL;
// }
......
......@@ -479,7 +479,7 @@ class BetterExposedFilters extends InputRequired {
}
// Alter the list of available widgets for this filter.
$this->moduleHandler->alter('better_exposed_filters_display_options', $options, $filter);
$this->moduleHandler->alter('better_exposed_filters_display_options', $options, $filter);
// Get a descriptive label for the filter.
$label = $this->t('Exposed filter @filter', [
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\better_exposed_filters\Kernel;
use Drupal\Tests\better_exposed_filters\Kernel\BetterExposedFiltersKernelTestBase;
use Drupal\views\Views;
/**
......
......@@ -33,8 +33,10 @@ class FilterWidgetKernelTest extends BetterExposedFiltersKernelTestBase {
$display = &$view->storage->getDisplay('default');
// Ensure our filter "field_bef_boolean_value" is grouped.
$display['display_options']['filters']['field_bef_boolean_value']['is_grouped'] = TRUE;
$display['display_options']['filters']['field_bef_boolean_value']['group_info'] = [
$display['display_options']['filters']['field_bef_boolean_value']
['is_grouped'] = TRUE;
$display['display_options']['filters']['field_bef_boolean_value']
['group_info'] = [
'plugin_id' => 'boolean',
'label' => 'bef_boolean (field_bef_boolean)',
'description' => '',
......@@ -64,7 +66,9 @@ class FilterWidgetKernelTest extends BetterExposedFiltersKernelTestBase {
// Check our "FIELD_BEF_BOOLEAN" filter is rendered with id
// "field_bef_boolean_value2".
$this->assertTrue(isset($output['field_bef_boolean_value2']), 'Exposed filter "FIELD_BEF_BOOLEAN" is exposed with id "field_bef_boolean_value2".');
$this->assertTrue(isset($output['field_bef_boolean_value2']),
'Exposed filter "FIELD_BEF_BOOLEAN" is exposed with id
"field_bef_boolean_value2".');
$view->destroy();
}*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment