Msieprawski\ResourceTable\Helpers\Column::searchableContent PHP Метод

searchableContent() публичный Метод

Returns HTML with column search field
public searchableContent ( array $config = [] ) : string
$config array
Результат string
    public function searchableContent(array $config = array())
    {
        $result = '';
        $type = $this->searchType();
        /*
         * Plain Bootstrap with glyphicons
         */
        if ('resource-table::bootstrap' === $this->_viewName) {
            switch ($type) {
                // Select
                case 'select':
                    if (!count($this->options())) {
                        // Options must be provided for select
                        return '';
                    }
                    $result .= '<select name="resource_table_' . $this->index() . '" class="' . array_get($config, 'control_class', 'form-control input-sm') . ' resource-table-column-filter">' . $this->_optionsHTML() . '</select>';
                    break;
                    // Simple string input
                // Simple string input
                case 'string':
                default:
                    $result .= '<input type="text" placeholder="' . array_get($config, 'placeholder', trans('resource-table::default.Search_for') . ' ' . $this->label()) . '" class="' . array_get($config, 'control_class', 'form-control input-sm') . ' resource-table-column-filter" name="resource_table_' . $this->index() . '" value="' . ResourceTable::getSearchValue($this->index()) . '" />';
                    break;
            }
        }
        /*
         * Just simple table
         */
        if (!$result) {
            switch ($type) {
                // Select
                case 'select':
                    if (!count($this->options())) {
                        // Options must be provided for select
                        return '';
                    }
                    $result .= '<select name="resource_table_' . $this->index() . '" class="' . array_get($config, 'control_class') . ' resource-table-column-filter">' . $this->_optionsHTML() . '</select>';
                    break;
                    // Simple string input
                // Simple string input
                case 'string':
                default:
                    $result .= '<input type="text" class="' . array_get($config, 'control_class') . ' resource-table-column-filter" name="resource_table_' . $this->index() . '" value="' . ResourceTable::getSearchValue($this->index()) . '" placeholder="' . array_get($config, 'placeholder') . '" />';
                    break;
            }
        }
        return $result;
    }