<commit_before><?php

namespace Frontend\Modules\Search\Widgets;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\Widget as FrontendBaseWidget;
use Frontend\Core\Engine\Form as FrontendForm;
use Frontend\Core\Engine\Navigation as FrontendNavigation;

/**
 * This is a widget with the search form
 */
class Form extends FrontendBaseWidget
{
    /**
     * @var FrontendForm
     */
    private $frm;

    /**
     * Execute the extra
     */
    public function execute()
    {
        parent::execute();
        $this->loadTemplate();
        $this->loadForm();
        $this->parse();
    }

    /**
     * Load the form
     */
    private function loadForm()
    {
        $this->frm = new FrontendForm('search', FrontendNavigation::getURLForBlock('Search'), 'get', null, false);
        $widgetField = $this->frm->addText('q_widget');

        $widgetField->setAttributes(
            array(
                'itemprop' => 'query-input',
                'data-role' => 'fork-widget-search-field',
            )
        );
    }

    /**
     * Parse the data into the template
     */
    private function parse()
    {
        $this->addJS('/js/vendors/typeahead.bundle.min.js', 'Core', false, true);
        $this->addCSS('Search.css');
        $this->frm->parse($this->tpl);
    }
}<commit_msg>Fix loading the  typeahead js in the search widget<commit_after><?php

namespace Frontend\Modules\Search\Widgets;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\Widget as FrontendBaseWidget;
use Frontend\Core\Engine\Form as FrontendForm;
use Frontend\Core\Engine\Navigation as FrontendNavigation;

/**
 * This is a widget with the search form
 */
class Form extends FrontendBaseWidget
{
    /**
     * @var FrontendForm
     */
    private $frm;

    /**
     * Execute the extra
     */
    public function execute()
    {
        parent::execute();
        $this->loadTemplate();
        $this->loadForm();
        $this->parse();
    }

    /**
     * Load the form
     */
    private function loadForm()
    {
        $this->frm = new FrontendForm('search', FrontendNavigation::getURLForBlock('Search'), 'get', null, false);
        $widgetField = $this->frm->addText('q_widget');

        $widgetField->setAttributes(
            array(
                'itemprop' => 'query-input',
                'data-role' => 'fork-widget-search-field',
            )
        );
    }

    /**
     * Parse the data into the template
     */
    private function parse()
    {
        $this->addJS('/js/vendors/typeahead.bundle.min.js', true, false);
        $this->addCSS('Search.css');
        $this->frm->parse($this->tpl);
    }
}
{'fraction_non_alphanumeric': 0.1365338781069118, 'fraction_numerical': 0.0, 'mean_word_length': 2.2826815642458103, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1551670', 'n_tokens_mistral': 875, 'n_tokens_neox': 860, 'n_words': 213}