[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_finder/tmpl/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_finder
   6   *
   7   * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\HTML\HTMLHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\Router\Route;
  16  use Joomla\Module\Finder\Site\Helper\FinderHelper;
  17  
  18  // Load the smart search component language file.
  19  $lang = $app->getLanguage();
  20  $lang->load('com_finder', JPATH_SITE);
  21  
  22  $input = '<input type="text" name="q" id="mod-finder-searchword' . $module->id . '" class="js-finder-search-query form-control" value="' . htmlspecialchars($app->input->get('q', '', 'string'), ENT_COMPAT, 'UTF-8') . '"'
  23      . ' placeholder="' . Text::_('MOD_FINDER_SEARCH_VALUE') . '">';
  24  
  25  $showLabel  = $params->get('show_label', 1);
  26  $labelClass = (!$showLabel ? 'visually-hidden ' : '') . 'finder';
  27  $label      = '<label for="mod-finder-searchword' . $module->id . '" class="' . $labelClass . '">' . $params->get('alt_label', Text::_('JSEARCH_FILTER_SUBMIT')) . '</label>';
  28  
  29  $output = '';
  30  
  31  if ($params->get('show_button', 0)) {
  32      $output .= $label;
  33      $output .= '<div class="mod-finder__search input-group">';
  34      $output .= $input;
  35      $output .= '<button class="btn btn-primary" type="submit"><span class="icon-search icon-white" aria-hidden="true"></span> ' . Text::_('JSEARCH_FILTER_SUBMIT') . '</button>';
  36      $output .= '</div>';
  37  } else {
  38      $output .= $label;
  39      $output .= $input;
  40  }
  41  
  42  Text::script('MOD_FINDER_SEARCH_VALUE', true);
  43  
  44  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  45  $wa = $app->getDocument()->getWebAssetManager();
  46  $wa->getRegistry()->addExtensionRegistryFile('com_finder');
  47  
  48  /*
  49   * This segment of code sets up the autocompleter.
  50   */
  51  if ($params->get('show_autosuggest', 1)) {
  52      $wa->usePreset('awesomplete');
  53      $app->getDocument()->addScriptOptions('finder-search', array('url' => Route::_('index.php?option=com_finder&task=suggestions.suggest&format=json&tmpl=component', false)));
  54  }
  55  
  56  $wa->useScript('com_finder.finder');
  57  
  58  ?>
  59  
  60  <form class="mod-finder js-finder-searchform form-search" action="<?php echo Route::_($route); ?>" method="get" role="search">
  61      <?php echo $output; ?>
  62  
  63      <?php $show_advanced = $params->get('show_advanced', 0); ?>
  64      <?php if ($show_advanced == 2) : ?>
  65          <br>
  66          <a href="<?php echo Route::_($route); ?>" class="mod-finder__advanced-link"><?php echo Text::_('COM_FINDER_ADVANCED_SEARCH'); ?></a>
  67      <?php elseif ($show_advanced == 1) : ?>
  68          <div class="mod-finder__advanced js-finder-advanced">
  69              <?php echo HTMLHelper::_('filter.select', $query, $params); ?>
  70          </div>
  71      <?php endif; ?>
  72      <?php echo FinderHelper::getGetFields($route, (int) $params->get('set_itemid', 0)); ?>
  73  </form>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer