Render search form tag

@return string
774339
public function render()
    {
        $pageUid = $this->arguments['pageUid'];
        if ($pageUid === null && !empty($this->getTypoScriptConfiguration()->getSearchTargetPage())) {
            $pageUid = $this->getTypoScriptConfiguration()->getSearchTargetPage();
        }

        $uri = $this->buildUriFromPageUidAndArguments($pageUid);

        $this->tag->addAttribute('action', trim($uri));
        if ($this->arguments['addSuggestUrl']) {
            $this->tag->addAttribute('data-suggest', $this->getSuggestUrl($this->arguments['additionalFilters'], $pageUid));
        }
        $this->tag->addAttribute('data-suggest-header', htmlspecialchars($this->arguments['suggestHeader']));
        $this->tag->addAttribute('accept-charset', $this->frontendController->metaCharset);

        // Get search term
        $this->getTemplateVariableContainer()->add('q', $this->getQueryString());
        $this->getTemplateVariableContainer()->add('pageUid', $pageUid);
        $this->getTemplateVariableContainer()->add('languageUid', $this->frontendController->sys_language_uid);

        $this->getTemplateVariableContainer()->add('addPageAndLanguageId', !$this->getIsSiteManagedSite($pageUid));
        $formContent = $this->renderChildren();
        $this->getTemplateVariableContainer()->remove('addPageAndLanguageId');
        $this->getTemplateVariableContainer()->remove('q');
        $this->getTemplateVariableContainer()->remove('pageUid');
        $this->getTemplateVariableContainer()->remove('languageUid');

        $this->tag->setContent($formContent);

        return $this->tag->render();
    }
1347515
protected function render(): string
    {
        switch ($this->mode) {
            case 'button':
                $html = '<button class="btn' . $this->classes() . '" type="submit"' .
                    (($this->disabled === true) ? ' disabled' : null) .
                    '>' . $this->label . '</button>';
                break;

            case 'input':
                $html = '<input class="btn' . $this->classes() . '" type="' .
                    $this->input_type . '" value="' .
                    $this->label . '" ' .
                    (($this->disabled === true) ? ' disabled ' : null) . '/>';
                break;

            default:
                $html = '<a href="' . (($this->uri !== null) ? $this->uri : '#') .
                    '" class="btn' . $this->classes() .
                    (($this->disabled === true) ? ' disabled' : null) .
                    '" role="button">' . $this->label . '</a>';
                break;
        }

        return $html;
    }
666244
private function form() {

    // Iterate through all the fields, rendering them
    foreach ( $this -> form_fields as $form_field ) {
      // Get Tag Type (input, select, option, button...)
      $tag_type = $form_field -> getTagType();
      $html_field = "";

      if( $this -> isUsingBootstrap() ){
        $html_field .= "<div class='form-group'>";
      }

      echo $form_field -> getFieldPreHTML();

      $html_field .= "<" . $tag_type . " ";
      $attributes = $form_field -> getAttributes();

      foreach ( $attributes as $att => $val ) {
        $html_field .= $att . "='" . $val . "' ";
      }
      // Remove last whitespace
      $html_field = rtrim($html_field);
      $html_field .= ">";

      if ( $tag_type == "button" || $tag_type == "a" || $tag_type == "select" ){
        if( $tag_type == "select" ){
          $options = $form_field -> getOptions();
          $values = $form_field -> getValues();
          // First option (Disabled)
          $html_field .= "<option value='' disabled='disabled' selected='true'>" . $form_field -> getFirstOption() . "</option>";
          foreach ($options as $option_key => $option_value ) {
            $html_field .= "<option value='" . $values[$option_key] . "'>" . $option_value . "</option>";
          }
          $html_field .= "</" . $tag_type . ">";
        }else{
          $html_field .= $form_field -> getInnerText();
          $html_field .= "</" . $tag_type . ">";
        }
      }

      if( $this -> isUsingBootstrap() ){
        $html_field .= "</div>";
      }

      echo $html_field;
    }

    echo $form_field -> getFieldPostHTML();
  }
1177418
public function SearchForm()
    {
        $searchText = '';
        if ($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
            $searchText = $this->owner->getRequest()->getVar('Search');
        }

        $placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search');
        $fields = FieldList::create(
            TextField::create('Search', false, $searchText)
                ->setAttribute('placeholder', $placeholder)
        );
        $actions = FieldList::create(
            FormAction::create('results', _t('SilverStripe\\CMS\\Search\\SearchForm.GO', 'Go'))
        );
        /** @skipUpgrade */
        $form = SearchForm::create($this->owner, 'SearchForm', $fields, $actions);
        $form->classesToSearch(FulltextSearchable::get_searchable_classes());
        return $form;
    }
1210245
public function renderTableAsHtml()
    {
        $render = '';
        $tableConfig = $this->getTable()->getOptions();

        if ($tableConfig->getShowColumnFilters()) {
            $render .= $this->renderFilters();
        }

        $render .= $this->renderHead();
        $render = sprintf('<thead>%s</thead>', $render);
        $render .= $this->getTable()->getRow()->renderRows();
        $table = sprintf('<table %s>%s</table>', $this->getTable()->getAttributes(), $render);

        $view = new \Zend\View\Model\ViewModel();
        $view->setTemplate('container');

        $view->setVariable('table', $table);

        $view->setVariable('paginator', $this->renderPaginator());
        $view->setVariable('paramsWrap', $this->renderParamsWrap());
        $view->setVariable('itemCountPerPage', $this->getTable()->getParamAdapter()->getItemCountPerPage());
        $view->setVariable('quickSearch', $this->getTable()->getParamAdapter()->getQuickSearch());
        $view->setVariable('name', $tableConfig->getName());
        $view->setVariable('itemCountPerPageValues', $tableConfig->getValuesOfItemPerPage());
        $view->setVariable('showQuickSearch', $tableConfig->getShowQuickSearch());
        $view->setVariable('showPagination', $tableConfig->getShowPagination());
        $view->setVariable('showItemPerPage', $tableConfig->getShowItemPerPage());
        $view->setVariable('showExportToCSV', $tableConfig->getShowExportToCSV());

        return $this->getRenderer()->render($view);
    }
741160
public function render_search_disabled() {
        $content = $this->output->box_start();
        $content .= $this->output->notification(get_string('globalsearchdisabled', 'search'), 'notifymessage');
        $content .= $this->output->box_end();
        return $content;
    }
944650
private function render()
    {
        if (empty($this->element)) {
            $this->textInput();
        }
        
        if (!isset($this->parts['{label}'])) {
            $this->label($this->label);
        }
        
        if (!isset($this->parts['{initValue}'])) {
            $this->initValue(null);
        }
    
        return str_replace([
            '{label}', '{initValue}', '{model}',
        ], [
            $this->parts['{label}'],
            $this->parts['{initValue}'],
            $this->getNgModel(),
        ], $this->element);
    }
1345445
protected function getInputTag()
    {
        $tag = new SwatHtmlTag('input');
        $tag->type = 'text';
        $tag->name = $this->autocomplete ? $this->id : $this->getNonce();
        $tag->id = $this->autocomplete ? $this->id : $this->getNonce();
        $tag->class = $this->getCSSClassString();

        // event handlers to select on focus
        if ($this->select_on_focus) {
            $tag->onmousedown = 'if(!this._focused){this._focus_click=true;}';
            $tag->onmouseup =
                'if(this._focus_click){' .
                'this.select();this._focus_click=false;}';

            $tag->onfocus =
                'this._focused=true;' .
                'if(!this._focus_click){this.select();}';

            $tag->onblur = 'this._focused=false;this._focus_click=false;';
        }

        if ($this->read_only) {
            $tag->readonly = 'readonly';
        }

        if (!$this->isSensitive()) {
            $tag->disabled = 'disabled';
        }

        $value = $this->getDisplayValue($this->value);

        // escape value for display because we actually want to show entities
        // for editing
        $value = htmlspecialchars($value);
        $tag->value = $value;

        $tag->size = $this->size;
        $tag->maxlength = $this->maxlength;
        $tag->accesskey = $this->access_key;
        $tag->tabindex = $this->tab_index;

        if ($this->placeholder != '') {
            $tag->placeholder = $this->placeholder;
        }

        return $tag;
    }
699480
public function renderQuickSearch()
    {
        if (!$this->dataProvider instanceof ActiveDataProvider || !$this->dataProvider->query instanceof ActiveQuery) {
            return '';
        }
        $id = $this->getId();
        $value = Html::encode($this->dataProvider->query->quickSearchPhrase);
        $placeholder = Yii::t('app', 'Search');
        $result = <<<HTML
        <div class="form-group">
            <div class="input-group grid-quick-search">
                <div class="input-group-btn">
                    <button class="btn btn-default" type="submit"><i class="mdi mdi-magnify"></i></button>
                </div>
                <input class="form-control"
                        id="{$id}-quickSearch" name="search" placeholder="$placeholder" value="$value" type="text"/>
                         <!--onkeyup="jQuery('#{$id}').yiiGridView('applyFilter')"-->
                <div class="input-group-btn">
                    <button class="btn btn-default" onclick="$('#{$id}-quickSearch').val('').change();return false;">
                        <i class="mdi mdi-close"></i>
                    </button>
                </div>
            </div>
        </div>
HTML;
        return $result;
    }
473824
protected function search_form($query = '', $tagcollid = 0) {
        $searchurl = new moodle_url('/tag/search.php');
        $output = '<form action="' . $searchurl . '">';
        $output .= '<label class="accesshide" for="searchform_query">' . get_string('searchtags', 'tag') . '</label>';
        $output .= '<input id="searchform_query" name="query" type="text" size="40" value="' . s($query) . '" />';
        $tagcolls = core_tag_collection::get_collections_menu(false, true, get_string('inalltagcoll', 'tag'));
        if (count($tagcolls) > 1) {
            $output .= '<label class="accesshide" for="searchform_tc">' . get_string('selectcoll', 'tag') . '</label>';
            $output .= html_writer::select($tagcolls, 'tc', $tagcollid, null, array('id' => 'searchform_tc'));
        }
        $output .= '<input name="go" type="submit" size="40" value="' . s(get_string('search', 'tag')) . '" />';
        $output .= '</form>';

        return $output;
    }
1082691
protected function renderSearch()
    {
        return str_replace(
            static::MARKER_KREXX_ID,
            $this->pool->recursionHandler->getMarker(),
            $this->getTemplateFileContent(static::FILE_SEARCH)
        );
    }
1041828
public function render() {
	
		$ret = '<input ' . $this->getNameProperty();
	
		switch ($this->type) {

            default:
            case 'text':
            case 'email':
            case 'tel':
            case 'url':
            case 'color':
            case 'password':
                $ret .= ' type="' . htmlspecialchars($this->type) . '" value="' . htmlspecialchars($this->value) . '"';
                break;
                
            case 'number':
            	$curr = setlocale(LC_NUMERIC, 0);
            	setlocale(LC_NUMERIC, 'en_US');
            	$ret .= ' type="number" value="' . htmlspecialchars($this->value) . '"';
            	setlocale(LC_NUMERIC, $curr);
            	break;

            case 'bool':
                $ret .= ' type="checkbox" value="1"';
                if ($this->value) $ret .= ' checked="checked"';
                break;
                
            case 'date':
                $ret .= ' type="date" value="' . htmlspecialchars($this->value) . '"';
				break;

			case 'datetime':
				$type = Input::usingCustomDatetimepicker() ? 'datetime' : 'datetime-local';
				$ret .= ' type="' . $type . '" value="' . htmlspecialchars($this->value) . '"';
				break;
				
			case 'file':
				$ret .= ' type="file"';
				break;
	
			case 'address':
				$ret .= ' type="text" value="'. htmlspecialchars($this->value) .'" size="50" autocomplete="on" placeholder=""';
				$this->addClass('googlePlacesAutocomplete');
				break;
	
			case 'hidden':
				$ret .= ' type="hidden" value="' . htmlspecialchars($this->value) . '"';
				break;
	
		}
		
		// set min and max value attribute for date and number only
		if (in_array($this->type, ['number','date'])) {
			
			if ($this->min) {
				$ret .= ' min="' . htmlspecialchars($this->min) . '"';
			}
			
			if ($this->max) {
				$ret .= ' max="' . htmlspecialchars($this->max) . '"';
			}
			
		}
		
		// set minlength attribute
		if ($this->minLength) {
			$ret .= ' minlength="' . htmlspecialchars($this->minLength) . '"';
		}
		
		// set maxlength attribute
		if ($this->maxLength) {
			$ret .= ' maxlength="' . htmlspecialchars($this->maxLength) . '"';
		}
	
		// set accept attribute
		if ($this->accept) {
			$ret .= ' accept="' . $this->accept . '"';
		}
		
		// set step attribute
		if ($this->step) {
			$ret .= ' step="' . htmlspecialchars($this->step) . '"';
		}
		
		$ret .= $this->processProperties() . ' />';
	
		return $ret;
	
	}
697405
public function getTagsFromSearchResult()
    {
        $tags = $tagsForResult = array();
        $tagChar = $this->pObj->extConf['prePostTagChar'];
        $tagDivider = $tagChar . ',' . $tagChar;

        if ($this->sphinxSearchEnabled()) {
            $tagsForResult = $this->getTagsFromSphinx();
        } else {
            $tagsForResult = $this->getTagsFromMySQL();
        }
        foreach ($tagsForResult as $tagSet) {
            $tagSet = explode($tagDivider, trim($tagSet, $tagChar));
            foreach ($tagSet as $tag) {
                $tags[$tag] += 1;
            }
        }
        return $tags;
    }
694123
public function render() : string 
  {
    $sOutput = preg_replace_callback(
      '/{(.*?)}/',
      function ($aResult){
        $aToSearch = explode('.', $aResult[1]);
        $aSearchIn = $this->getData();

        foreach ($aToSearch as $sKey) {
          list(
            $sFormattedKey, 
            $mParam
          )       = self::getFunctionNameAndParameter($sKey);
          $mValue = $aSearchIn[$sFormattedKey];

          if(is_string($mValue)) {

            return $mValue;
          } else if(is_object($mValue)) {
            if($mParam){

              return $mValue($mParam);
            }

            return $mValue();
          }
          
          $aSearchIn = $mValue;
        }

        return (
          $this->hasShowEmpty() 
          ? 
          $aResult[0] 
          : 
          ''
        );
      },
      $this->getTemplate()
    );
    
    return preg_replace('/^\s+|\n|\r|\t/m', '', $sOutput);
  }
4632
protected function getInputTag()
    {
        // We do not use a 'button' element because it is broken differently in
        // different versions of Internet Explorer

        $tag = new SwatHtmlTag('input');

        $tag->type = 'submit';
        $tag->name = $this->id;
        $tag->id = $this->id;
        $tag->value = $this->title;
        $tag->class = $this->getCSSClassString();
        $tag->tabindex = $this->tab_index;
        $tag->accesskey = $this->access_key;

        if (!$this->isSensitive()) {
            $tag->disabled = 'disabled';
        }

        return $tag;
    }
444638
public function render()
    {
        // Different conditions for different types of tags
        switch ($this->element) {

            // Img tags use the src
            case 'img':
                if (empty($this->getAttribute('src'))) {
                    return '';
                }
                break;

            // Divs have the image as a background-image
            // https://regex101.com/r/eF0oD0/1
            default:
                if (!preg_match('#background-image:\s*url\([\'"]?[\w\/]#',
                    $this->getAttribute('style'))) {
                    return '';
                }
        }

        // Carry on with normal rendering
        return parent::render();
    }
934019
protected function render_select(): string
    {
        if (!$this->choices) {
            return '';
        }

        $html = '<select '.$this->metaString().' id="'.
            $this->escape->attr($this->id).'" name="'.
            $this->escape->attr($this->name).'">';

        foreach ($this->choices as $value => $label) {
            if (isset($this->meta['multiple'])) {
                $selected = $this->selected(
                    $value,
                    (\in_array($value, (array)$this->value) ? $value : '')
                );
            } else {
                $selected = $this->selected($value, $this->value);
            }

            $html .= '<option '.$selected.' value="'.
                $this->escape->attr($value).'">'.$label.'</option>';
        }

        $html .= '</select>';

        return $html;
    }