src/Rhyme/WMassArtsHub/ProfileFilter/Keywords.php line 38

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (C) 2021 Rhyme Digital, LLC
  4.  *
  5.  * @author        Blair Winans <blair@rhyme.digital>
  6.  * @author        Adam Fisher <adam@rhyme.digital>
  7.  * @link        https://rhyme.digital
  8.  * @license        http://www.gnu.org/licenses/lgpl-3.0.html LGPL
  9.  */
  10. namespace Rhyme\WMassArtsHub\ProfileFilter;
  11. use Contao\Input;
  12. use Contao\Template;
  13. use Contao\Module;
  14. /**
  15.  * Class Keywords
  16.  * Keywords filter
  17.  */
  18. class Keywords extends ProfileFilter
  19. {
  20.     
  21.     /**
  22.      * Filter key
  23.      * @var string
  24.      */
  25.     protected static $strKey 'keywords';
  26.     /**
  27.      * Add this filter to the module's template or get the URL params
  28.      * @param Template $objTemplate
  29.      * @param Module $objModule
  30.      * @param bool $blnGenURL
  31.      * @return bool|mixed|string
  32.      */
  33.     public static function generateFilter(Template &$objTemplateModule $objModulebool $blnGenURL=false)
  34.     {
  35.         if($blnGenURL)
  36.         {
  37.             // Return the URL fragment needed for this filter to pass to the lister
  38.             if ((Input::post(static::$strKey)) && \trim(Input::post(static::$strKey)) != $GLOBALS['TL_LANG']['MSC']['defaultSearchText'])
  39.             {
  40.                 return static::$strKey '/' . \urlencode(ProfileFilter::cleanChars(Input::post(static::$strKey)));
  41.             }
  42.             
  43.             return false;
  44.         }
  45.         
  46.         $objTemplate->hasSearch true;
  47.         $objTemplate->hasAutocomplete = \strlen($objModule->artshub_searchAutocomplete) ? true false;
  48.         $objTemplate->keywords htmlentities(ProfileFilter::uncleanChars(Input::get(static::$strKey)));
  49.         $objTemplate->pkeywordsLabel $GLOBALS['TL_LANG']['MSC'][static::$strKey.'FilterLabel'];
  50.         $objTemplate->defaultSearchText $GLOBALS['TL_LANG']['MSC']['defaultSearchText'];
  51.     }
  52. }