valueTitle = t('Allowed node titles'); $this->definition['options callback'] = [$this, 'generateOptions']; } /** * Override the query. * * So that no filtering takes place if the user doesn't * select any options. */ public function query() { if (!empty($this->value)) { parent::query(); } } /** * Skip validation. * * If no options have been chosen so we can use it as a non-filter. */ public function validate() { if (!empty($this->value)) { parent::validate(); } } /** * Helper function that generates the options. * * @return array * Array keys are used to compare with the table field values. */ public function generateOptions() { return [ 'my title' => 'my title', 'another title' => 'another title', ]; } }