Skip to content
Snippets Groups Projects
Commit 881eced3 authored by Alejandro Madrigal's avatar Alejandro Madrigal
Browse files

#2907095: Adding check for input required in the exposed form handler.

parent 420459b4
No related branches found
No related tags found
1 merge request!51#2907095: Adding check for input required in the exposed form handler.
......@@ -6,6 +6,7 @@ use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
......@@ -108,9 +109,13 @@ class ViewsReferenceFieldFormatter extends FormatterBase {
$view->preExecute();
$view->execute($display_id);
// Exposed form handler.
/** @var ExposedFormPluginBase $exposed_form_handler */
$exposed_form_handler = $view->display_handler->getPlugin('exposed_form');
$render_array = $view->buildRenderable($display_id, $view->args, FALSE);
if (!empty(array_filter($this->getSetting('plugin_types')))) {
if (!empty($view->result) || !empty($view->empty)) {
if (!empty($view->result) || !empty($view->empty) || ($exposed_form_handler?->options['input_required'] ?? FALSE)) {
// Add a custom template if the title is available.
$title = $view->getTitle();
if (!empty($title)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment