Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295142

Handler break custom filter

$
0
0

I need your help.

I try to make a custom views filter with a entity reference. I have some problem. I have this message, when I declared :

The handler of this element is defective or missing. The following details are available

Activating the appropriate module can solve this problem. Otherwise, check if there is an available module update.
I get this message in "Entry report" section :

Activating the appropriate module can solve this problem. Otherwise, check if there is an available module update.
I get this message in "Entry report" section :

Hook implementation:

function module_views_data_alter(array &$data)
{

  $data['distri_prod_entity_field_data']['distri_id']['filter'] = [

          'id' => 'module_distri_prod_distri_filter'

      ];
}

Filter Class:

namespace Drupal\module\Plugin\view\filter;


use Drupal\module\Helper\DistributeurHelper;
use Drupal\views\Annotation\ViewsFilter;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\Plugin\views\filter\ManyToOne;
use Drupal\views\ViewExecutable;

/**
 * Filters by given list of node title options.
 *
 * @ingroup views_filter_handlers
 *
 * @ViewsFilter("module_distri_prod_distri_filter")
 */

class DistriProdDistriFilter extends ManyToOne
{

  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
    parent::init($view, $display, $options);
    $this->valueTitle = t('Allowed related content titles');
    $this->definition['options callback'] = array($this, 'generateOptions');
  }

  /**
   * Helper function that generates the options.
   * @return array
   */
  public function generateOptions() {
    return DistributeurHelper::OptionList();
  }

}

Can you help me?


Viewing all articles
Browse latest Browse all 295142

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>