Retrieve the list of available filter options.

@return  array                   An array whose keys are the valid options
And whose values are the values to display
423603
public static function get_filter_options() {
        $manager = \core_plugin_manager::instance();
        $themes = $manager->get_installed_plugins('theme');

        $options = [];
        foreach (array_keys($themes) as $themename) {
            try {
                $theme = \theme_config::load($themename);
            } catch (Exception $e) {
                // Bad theme, just skip it for now.
                continue;
            }
            if ($themename !== $theme->name) {
                // Obsoleted or broken theme, just skip for now.
                continue;
            }
            if ($theme->hidefromselector) {
                // The theme doesn't want to be shown in the theme selector and as theme
                // designer mode is switched off we will respect that decision.
                continue;
            }
            $options[$theme->name] = get_string('pluginname', "theme_{$theme->name}");
        }
        return $options;
    }
1002850
public function getOptions()
    {
        $options = [
            'name'     => $this->name,
            'sparse'   => is_bool($this->sparse) ? $this->sparse : false,
            'dropDups' => $this->dropDuplicates,
            'unique'   => $this->unique
        ];

        if (is_array($this->sparse)) {
            $options['partialFilterExpression'] = $this->sparse;
        }

        return $options;
    }
845573
public function getFilters()
    {
        return array(
            'timeAgo' => new \Twig_Filter_Method($this, 'timeAgo'),
            'homeLink' => new \Twig_Filter_Method($this, 'homeLink'),
            'activeLink' => new \Twig_Filter_Method($this, 'activeLink'),
            'activeRoute' => new \Twig_Filter_Method($this, 'activeRoute'),
            'compareRoute' => new \Twig_Filter_Method($this, 'compareRoute'),
            'autoLink' => new \Twig_Filter_Method($this, 'autoLink')
        );
    }
605983
public function getFilters()
    {
        $filters = isset($this->requestParams[self::PARAM_FILTERS]) ?
            $this->requestParams[self::PARAM_FILTERS] : self::DEFAULT_FILTERS;

        return $filters;
    }
172710
protected function getFilterArray()
    {
        return array_merge(parent::getFilterArray(), [
      self::PROPERTY_FILTER_ROLE => $this->arguments[self::ARGUMENT_FILTER_ROLE]
    ]);
    }
979909
public static function getOptionValues($filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/options/values' . $filter->toQuery(), 'OptionValue');
    }
1158726
public function getAdditionalFilters() : array
    {
        // when we've build the additionalFilter once, we could return them
        if (count($this->additionalFilters) > 0) {
            return $this->additionalFilters;
        }

        $searchQueryFilters = $this->typoScriptConfiguration->getSearchQueryFilterConfiguration();
        if (!is_array($searchQueryFilters) || count($searchQueryFilters) <= 0) {
            return [];
        }

        $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);

        // all other regular filters
        foreach ($searchQueryFilters as $filterKey => $filter) {
            // the __pageSections filter should not be handled as additional filter
            if ($filterKey === '__pageSections') {
                continue;
            }

            $filterIsArray = is_array($searchQueryFilters[$filterKey]);
            if ($filterIsArray) {
                continue;
            }

            $hasSubConfiguration = is_array($searchQueryFilters[$filterKey . '.']);
            if ($hasSubConfiguration) {
                $filter = $cObj->stdWrap($searchQueryFilters[$filterKey], $searchQueryFilters[$filterKey . '.']);
            }

            $this->additionalFilters[$filterKey] = $filter;
        }

        return $this->additionalFilters;
    }
915561
public function findFilterOptionsToDisplay($filter)
    {
        $options = array();

        foreach ($filter['options'] as $option) {
            // should we check if the filter option is available in
            // the current search result?

            if ($this->conf['checkFilterCondition'] != 'none') {
                // Once one filter option has been selected, don't display the
                // others anymore since this leads to a strange behaviour (options are
                // only displayed if they have BOTH tags: the selected and the other filter option.
                if ((!count($filter['selectedOptions'])
                        || in_array($option['uid'], $filter['selectedOptions'])
                    ) && $this->filters->checkIfTagMatchesRecords($option['tag'])
                ) {
                    // build link which selects this option and keeps all the other selected filters
                    unset($linkconf);
                    $linkconf['parameter'] = $GLOBALS['TSFE']->id;
                    $linkconf['additionalParams'] = '&tx_kesearch_pi1[sword]='
                        . $this->piVars['sword']
                        . '&tx_kesearch_pi1[filter]['
                        . $filter['uid']
                        . ']='
                        . $option['tag'];
                    $linkconf['useCacheHash'] = false;
                    if (is_array($this->piVars['filter']) && count($this->piVars['filter'])) {
                        foreach ($this->piVars['filter'] as $key => $value) {
                            if ($key != $filter['uid']) {
                                $linkconf['additionalParams'] .= '&tx_kesearch_pi1[filter][' . $key . ']=' . $value;
                            }
                        }
                    }
                    $optionLink = $this->cObj->typoLink_URL($linkconf);

                    $options[$option['uid']] = array(
                        'title' => $option['title'],
                        'value' => $option['tag'],
                        'results' => $this->tagsInSearchResult[$option['tag']],
                        'selected' => is_array($filter['selectedOptions'])
                            && in_array($option['uid'], $filter['selectedOptions']),
                        'link' => $optionLink
                    );
                }
            } else {
                // do not process any checks; show all filter options
                $options[$option['uid']] = array(
                    'title' => $option['title'],
                    'value' => $option['tag'],
                    'selected' =>
                        is_array($filter['selectedOptions'])
                        && !empty($filter['selectedOptions'])
                        && in_array($option['uid'], $filter['selectedOptions']),
                );
            }
        }

        return $options;
    }
119316
protected function getCustomFilters()
    {
        $filters = (array) $this->getOption('custom_filters');

        return array_filter(
            $filters,
            function ($name) {
                return is_string($name);
            },
            ARRAY_FILTER_USE_KEY
        );
    }
981086
public function getOptions()
    {
        $options = [];
        foreach ($this->toOptionArray() as $values) {
            $options[$values['value']] = __($values['label']);
        }
        return $options;
    }
1300143
protected function getFilters()
    {
        $filters = [];
        foreach ($this->filters as $alias => $opt) {
            if (!is_array($opt)) {
                $opt = ['filter' => $opt];
            }
            if (!isset($opt['filter'])) {
                throw new InvalidConfigException('Option "filter" required for filter alias "' . $alias . '".');
            }
            if (!isset($this->classmap[$opt['filter']])) {
                throw new InvalidConfigException('Unknown filter "' . $opt['filter'] . '".');
            }
            if (isset($opt['options'])) {
                if (!is_array($opt['options'])) {
                    throw new InvalidConfigException('Expects option "options" to be array, ' .
                        gettype($opt['options']) . ' given in filter "' . $opt['filter'] . '".');
                }
                $filters[$alias] = $this->createFilter($opt['filter'], $opt['options']);
            }
            else {
                $filters[$alias] = $this->createFilter($opt['filter']);
            }
        }
        return $filters;
    }
960874
protected function getOptions()
    {
        $baseOptions = [
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
        ];

        return array_merge($baseOptions, isset($this->options) ? $this->options : []);
    }
736770
public function getAllOptions() {
      $options = array();

      foreach($this->_flags as $option => $index) {
        if(array_key_exists($index, $this->_options)) {
          $options[$option] = $this->_options[$index];
        }
      }

      return $options;
    }
650955
public function getFilters()
    {
        return [
            new TwigFilter('download', [$this, 'getDownload']),
            new TwigFilter('download_link', [$this, 'getDownloadLink']),
            new TwigFilter('download_path', [$this, 'getDownloadPath']),
            new TwigFilter('download_data', [$this, 'getDownloadData']),
            new TwigFilter('download_title', [$this, 'getDownloadTitle']),
        ];
    }
841243
public function getFilters()
    {
        $roles = user_roles(true);
        unset($roles[DRUPAL_AUTHENTICATED_RID]);

        return [
            (new Filter('status', $this->t("Active")))->setChoicesMap(
                [
                    0 => $this->t("No"),
                    1 => $this->t("Yes"),
                ]
            ),
            (new Filter('role', $this->t("Role")))->setChoicesMap($roles),
            (new Filter('name', $this->t("Name"))),
        ];
    }
1143988
protected function build_available_filters() {
        $selectedoptions = [];
        $availablefilters = [];

        $versionid = $this->get_version_id_filter();
        $policyid = $versionid ? $this->get_single_version()->policyid : $this->get_policy_id_filter();

        // Policies.
        $policies = $this->get_avaliable_policies();
        if ($policyid) {
            // If policy is selected, display only the current policy in the selector.
            $selectedoptions[] = $key = self::FILTER_POLICYID . ':' . $policyid;
            $version = $versionid ? $policies[$policyid]->versions[$versionid] : reset($policies[$policyid]->versions);
            $availablefilters[$key] = get_string('filterpolicy', 'tool_policy', $version->name);
        } else {
            // If no policy/version is selected display the list of all policies.
            foreach ($policies as $policy) {
                $firstversion = reset($policy->versions);
                $key = self::FILTER_POLICYID . ':' . $policy->id;
                $availablefilters[$key] = get_string('filterpolicy', 'tool_policy', $firstversion->name);
            }
        }

        // Versions.
        if ($versionid) {
            $singleversion = $this->get_single_version();
            $selectedoptions[] = $key = self::FILTER_VERSIONID . ':' . $singleversion->id;
            $availablefilters[$key] = $this->get_version_option_for_filter($singleversion);
        } else if ($policyid) {
            foreach ($policies[$policyid]->versions as $version) {
                $key = self::FILTER_VERSIONID . ':' . $version->id;
                $availablefilters[$key] = $this->get_version_option_for_filter($version);
            }
        }

        // Permissions.
        $permissions = [
            self::FILTER_CAPABILITY_ACCEPT . ':1' => get_string('filtercapabilityyes', 'tool_policy'),
            self::FILTER_CAPABILITY_ACCEPT . ':0' => get_string('filtercapabilityno', 'tool_policy'),
        ];
        if (($currentpermission = $this->get_capability_accept_filter()) !== null) {
            $selectedoptions[] = $key = self::FILTER_CAPABILITY_ACCEPT . ':' . $currentpermission;
            $permissions = array_intersect_key($permissions, [$key => true]);
        }
        $availablefilters += $permissions;

        // Status.
        $statuses = [
            self::FILTER_STATUS.':2' => get_string('filterstatusdeclined', 'tool_policy'),
            self::FILTER_STATUS.':1' => get_string('filterstatusyes', 'tool_policy'),
            self::FILTER_STATUS.':0' => get_string('filterstatuspending', 'tool_policy'),
        ];
        if (($currentstatus = $this->get_status_filter()) !== null) {
            $selectedoptions[] = $key = self::FILTER_STATUS . ':' . $currentstatus;
            $statuses = array_intersect_key($statuses, [$key => true]);
        }
        $availablefilters += $statuses;

        // Roles.
        $currentroles = $this->get_role_filters();
        foreach ($this->roles as $roleid => $rolename) {
            $key = self::FILTER_ROLE . ':' . $roleid;
            $availablefilters[$key] = get_string('filterrole', 'tool_policy', $rolename);
            if (in_array($roleid, $currentroles)) {
                $selectedoptions[] = $key;
            }
        }

        // Search string.
        foreach ($this->get_search_strings() as $str) {
            $selectedoptions[] = $str;
            $availablefilters[$str] = $str;
        }

        return [$availablefilters, $selectedoptions];
    }
1206272
public function getFilters()
    {
        // @todo build commong database filters for node datasource into some
        //   trait or abstract implemetnation to avoid duplicates
        return [
            (new Filter('status', $this->t("Published")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('promote', $this->t("Promoted to front page")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('sticky', $this->t("Sticky")))
                ->setChoicesMap([
                    1 => $this->t("Yes"),
                    0 => $this->t("No"),
                ]),
            (new Filter('type', $this->t("Type")))
                ->setChoicesMap(node_type_get_names()),
            (new Filter('history_user_id', $this->t("User (history)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
            (new Filter('revision_user_id', $this->t("User (node revision)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
            (new Filter('user_id', $this->t("User (node owner)"))),
                /* ->setChoicesMap(node_type_get_names()), @todo use callback */
        ];
    }