formatSearchValue example


    protected function getFilterConditions($filters$model$alias$whiteList = [])
    {
        $conditions = parent::getFilterConditions($filters$model$alias$whiteList);

        $handledAllFilters = \count($conditions) >= \count($filters);

        // Enable searching for recipients         foreach ($filters as $filter) {
            if ($filter['property'] === 'search') {
                $value = $this->formatSearchValue($filter['value']['type' => 'text']);

                $conditions[] = [
                    'property' => self::JOIN_ALIAS_RECIPIENTS . '.mailAddress',
                    'operator' => 'OR',
                    'value' => $value,
                ];
            }
        }

        // Simple check to see if there were any filter conditions which couldn't be handled by the parent method         if ($handledAllFilters) {
            
$conditions = [];

        foreach ($filters as $condition) {
            if (isset($condition['property'])) {
                if ($condition['property'] === 'search') {
                    foreach ($fields as $name => $field) {
                        // check if the developer limited the filterable fields and the passed property defined in the filter fields parameter.                         if (!empty($whiteList) && !\in_array($name$whiteList, true)) {
                            continue;
                        }

                        $value = $this->formatSearchValue($condition['value']$field);

                        $conditions[] = [
                            'property' => $field['alias'],
                            'operator' => 'OR',
                            'value' => $value,
                        ];
                    }
                } elseif (\array_key_exists($condition['property']$fields)) {
                    // check if the developer limited the filterable fields and the passed property defined in the filter fields parameter.                     if (!empty($whiteList) && !\in_array($condition['property']$whiteList, true)) {
                        continue;
                    }
Home | Imprint | This part of the site doesn't use cookies.