Back to PhocacartSearch class

Method renderSearch

public
renderSearch
(mixed $options = array())

Method renderSearch - Source code

public function renderSearch($options = array())
{
    $o = array();
    $app = Factory::getApplication();
    $s = PhocacartRenderStyle::getStyles();
    $layout = new FileLayout('form_search', null, array('component' => 'com_phocacart'));
    $layoutAP = new FileLayout('form_search_active_parameters', null, array('component' => 'com_phocacart'));
    // SEARCH FORM
    $data = array();
    $data['s'] = $s;
    $data['id'] = 'phSearchBox';
    // AJAX ID
    $data['param'] = 'search';
    $data['getparams'] = PhocacartText::filterValue($app->input->get('search', '', 'string'), 'text');
    $data['title'] = Text::_('COM_PHOCACART_SEARCH');
    //$category				    = PhocacartRoute::getIdForItemsRoute();
    //$data['getparams'][]	    = $category['idalias'];
    $data['activefilter'] = PhocacartRoute::isFilterActive();
    //$data['searchoptions']	= $searchOptions;
    $data['search_options'] = $this->search_options;
    $data['hide_buttons'] = $this->hide_buttons;
    $data['display_inner_icon'] = $this->display_inner_icon;
    $data['placeholder_text'] = $this->placeholder_text;
    $filter = new PhocacartFilter();
    $f = $filter->getActiveFilterValues();
    $dataAP = array();
    $dataAP['s'] = $s;
    $dataAP['f'] = $f;
    $dataAP['id'] = 'phSearchActiveTags';
    if ($this->ajax == 0) {
        $o[] = '<div class="' . $data['s']['c']['row'] . '">';
        $o[] = '<div class="' . $data['s']['c']['col.xs12.sm12.md12'] . '">';
        $o[] = '<div id="' . $data['id'] . '">';
        $o[] = $layout->render($data);
    }
    if ($this->display_active_parameters) {
        if ($this->ajax == 0) {
            $o[] = '<div id="' . $dataAP['id'] . '">';
        }
        $o[] = $layoutAP->render($dataAP);
        // only this is displayed by ajax but if display_active_parameters is enabled
        if ($this->ajax == 0) {
            $o[] = '</div>';
        }
    }
    if ($this->ajax == 0) {
        $o[] = '</div>';
        $o[] = '</div>';
        $o[] = '</div>';
    }
    $o2 = implode("\n", $o);
    return $o2;
}