Render element

@param ...$params
@return mixed
555680
public function render($index , ...$params)
    {

        $renderer = $this->getRenderer($index);

        // If it's a anonymous function
        if (!is_string($renderer)  && is_callable($renderer)) {
            $render = call_user_func_array($renderer, $params);

            // if it's a local method
        } else {

            if (!method_exists($this, $renderer)) {
                throw new \Exception('Impossible de trouver la method pour le rendu : ' . $renderer);
            }

            $render =  call_user_func_array([$this, $renderer], $params);
        }

        return $render;
    }
189948
public function render($tpl, $params = [])
    {
        $this->setTemplate($tpl);
        $this->params = (object) $params;
        return $this->retrieve();
    }
668601
public function request($params)
  {
    $query = array_merge($params, [
      'key' => $this->key
    ]);

    try {

      $response = $this->client->get(self::API_ENDPOINT, [
        'query' => $query
      ]);

    } catch (ClientException $exception) {

      return collect([]);

    }

    $results = json_decode($response->getBody(), true);

    $output = [];

    for($i = 0; $i < count($results['itemListElement']); $i++) {
      $output[] = new SearchResult($results['itemListElement'][$i]);
    }

    return collect($output);
  }
1024181
public function renderForm($element = 'form', $params = [])
    {
        $this->controller->requireAsset('javascript', 'backstretch');

        $form_element = $this->mapAuthenticationTypeFilePath($element . '.php');
        if (!$form_element->exists()) {
            $form_element = $this->mapAuthenticationTypeFilePath('form.php');
            if (method_exists($this->controller, 'form')) {
                call_user_func_array([$this->controller, 'form'], $params);
            }
        }
        ob_start();
        if (method_exists($this->controller, $element)) {
            call_user_func_array([$this->controller, $element], $params);
        } else {
            $this->controller->view();
        }
        extract(array_merge($params, $this->controller->getSets()));
        require $form_element->file;
        $out = ob_get_contents();
        ob_end_clean();
        echo $out;
    }
5819
protected static function renderXML($file, $params)
    {
        // check if already loaded
        if (empty(static::$xml[$file])) {
            // load if file not loaded
            static::$xml[$file] = file_get_contents(__DIR__ . '/xml/'.$file.'.xml');
        }

        // build the search and replace arrays
        $search = [];
        $replace = [];

        foreach ($params as $key => $value) {
            $search[] = ':'.$key;
            $replace[] = $value;
        }

        // return the rendered file
        return str_replace($search, $replace, static::$xml[$file]);
    }
340408
public function renderElements()
    {
        $returnValue = '';


		foreach($this->elements as $element){

			 if($this->getElementGroup($element->getName()) !== ''){
			 	continue;	//render grouped elements after
			 }

			 if(!is_null($this->getDecorator()) && !($element instanceof tao_helpers_form_elements_Hidden)){
			 	$returnValue .= $this->getDecorator()->preRender();
			 }

             if(!$this->isValid() && $element->getError()) {
                $element->addClass('error');
             }

			 //render element
			 $returnValue .= $element->render();

			 //render element help
			 $help = trim($element->getHelp());
			 if(!empty($help)){
				 if(!is_null($this->getDecorator('help'))){
			 		$returnValue .= $this->getDecorator('help')->preRender();
			 	}

			 	$returnValue .= $help;

				if(!is_null($this->getDecorator('help'))){
			 		$returnValue .= $this->getDecorator('help')->postRender();
			 	}
			 }

			 //render error message
			 if(!$this->isValid() && $element->getError()){
			 	if(!is_null($this->getDecorator('error'))){
			 		$returnValue .= $this->getDecorator('error')->preRender();
			 	}

			 	$returnValue .= nl2br($element->getError());

				if(!is_null($this->getDecorator('error'))){
			 		$returnValue .= $this->getDecorator('error')->postRender();
			 	}
			 }

			 if(!is_null($this->getDecorator()) && !($element instanceof tao_helpers_form_elements_Hidden)){
			 	$returnValue .= $this->getDecorator()->postRender();
			 }
		}

		$subGroupDecorator = null;
		if(!is_null($this->getDecorator('group'))){
			$decoratorClass = get_class($this->getDecorator('group'));
			$subGroupDecorator = new $decoratorClass();
		}

		//render group
		foreach($this->groups as $groupName => $group){

			if(!is_null($this->getDecorator('group'))){
				$this->getDecorator('group')->setOption('id', $groupName);
				if(isset($group['options'])){
					if(isset($group['options']['class'])){
						$currentClasses = array_map('trim', explode(' ',$this->getDecorator('group')->getOption('cssClass')));
						if(!in_array($group['options']['class'], $currentClasses)){
							$currentClasses[] = $group['options']['class'];
							$this->getDecorator('group')->setOption('cssClass', implode(' ', array_unique($currentClasses)));
						}
					}
				}
				$returnValue .= $this->getDecorator('group')->preRender();
			}
			$returnValue .= $group['title'];
			if(!is_null($subGroupDecorator)){
				$returnValue .= $subGroupDecorator->preRender();
			}
			foreach($group['elements'] as $elementName){
				 if($this->getElementGroup($elementName) === $groupName && $element = $this->getElement( $elementName )){

				 	if(!is_null($this->getDecorator())){// && !($element instanceof tao_helpers_form_elements_Hidden) ){

					 	$returnValue .= $this->getDecorator()->preRender();
					 }

					 //render element
                     if ( ! $this->isValid() && $element->getError()) {
                         $element->addClass( 'error' );
                     }
					 $returnValue .= $element->render();

					 //render element help
					 $help = trim($element->getHelp());
					 if(!empty($help)){
						 if(!is_null($this->getDecorator('help'))){
					 		$returnValue .= $this->getDecorator('help')->preRender();
					 	}

					 	$returnValue .= $help;

						if(!is_null($this->getDecorator('help'))){
					 		$returnValue .= $this->getDecorator('help')->postRender();
					 	}
					 }

					 //render error message
					 if(!$this->isValid() && $element->getError()){
					 	if(!is_null($this->getDecorator('error'))){
					 		$returnValue .= $this->getDecorator('error')->preRender();
					 	}
					 	$returnValue .= nl2br($element->getError());
						if(!is_null($this->getDecorator('error'))){
					 		$returnValue .= $this->getDecorator('error')->postRender();
					 	}
					 }

					 if(!is_null($this->getDecorator())){// && !($element instanceof tao_helpers_form_elements_Hidden) ){
					 	$returnValue .= $this->getDecorator()->postRender();
					 }
				 }
			}
			if(!is_null($subGroupDecorator)){
				$returnValue .= $subGroupDecorator->postRender();
			}
			if(!is_null($this->getDecorator('group'))){
				$returnValue .= $this->getDecorator('group')->postRender();
				$this->getDecorator('group')->setOption('id', '');
			}
		}


        return $returnValue;
    }
1106762
public function render() {
        $rendered = '';
        foreach ($this->elements as $element) {
            if (!method_exists($this, 'openTag')) {
                $element->name = $this->multiple ?
                        $element->name . '[]' :
                        $this->getName() . '[' . $element->name . ']';

                $element->parent = $this->getName();
            }
            $rendered .= $element->render();
        }
        return $rendered;
    }
1139984
public function render($template=null, array $params=[]) {
		if($template === null)
			$template = $this->template;
		$params = array_merge($this->params, $params);

		return static::renderFile($template, $params);
	}
843224
protected function prepareParams($params)
    {
        $data = [];
        foreach ($params as $key => $value) {
            if (is_object($value) && Str::is('Illuminate\*\Events\*', get_class($value))) {
                $value = $this->prepareParams(get_object_vars($value));
            }
            $data[$key] = htmlentities($this->exporter->exportValue($value), ENT_QUOTES, 'UTF-8', false);
        }

        return $data;
    }
351270
public function renderString($template, array $params = null)
    {
        if (! empty($params)) {
            $this->assign($params);
        }

        $compiled = $this->getCompiler()->compile($template);

        $tempFile = tempnam(sys_get_temp_dir(), __FUNCTION__);

        $this->writeToFile($tempFile, $compiled);

        $template = $this->readBuffer($tempFile);

        unlink($tempFile);

        return $template;
    }
195616
protected static function compilePaging($param)
    {
        $parameters = self::parseParameters($param);
        $result = '';
        if (!empty($parameters['template']))
            $result .= "\$this->pagination->setTemplate(\$this->render('{$parameters['template']}'));\n?>";
        $link = 'null';
        if (!empty($parameters['link'])) {
            if ('$' != $parameters['link']{0})
                $parameters['link'] = '\'' . $parameters['link'] . '\'';
            $link = $parameters['link'];
        }
        $page = !empty($parameters['page']) ? $parameters['page'] : 'null';
        $total = !empty($parameters['total']) ? $parameters['total'] : 'null';
        $size = !empty($parameters['size']) ? $parameters['size'] : 'null';
        $result .= "<?php echo \$this->pagination->render({$link}, {$page}, {$total}, {$size});\n?>";

        return $result;
    }
1188784
private function mode($params) {

		$mode = 'params';

	 	if(count($params) > 0 && 0 === count(array_filter(array_keys($params), 'is_string'))) {
	 		$mode = 'bind';
	 	}

	 	return $mode;
	}
1274695
public static function render(array $parameters)
    {
        list($sortColumn, $sortParameter, $title, $queryParameters, $anchorAttributes) = self::parseParameters($parameters);

        $title = self::applyFormatting($title);

        if ($mergeTitleAs = config('columnsortable.inject_title_as', null)) {
            request()->merge([$mergeTitleAs => $title]);
        }

        list($icon, $direction) = self::determineDirection($sortColumn, $sortParameter);

        $trailingTag = self::formTrailingTag($icon);

        $anchorClass = self::getAnchorClass($sortParameter, $anchorAttributes);

        $anchorAttributesString = self::buildAnchorAttributesString($anchorAttributes);

        $queryString = self::buildQueryString($queryParameters, $sortParameter, $direction);

        return '<a'.$anchorClass.' href="'.url(request()->path().'?'.$queryString).'"'.$anchorAttributesString.'>'.htmlentities($title).$trailingTag;
    }
611968
private function renderContent($params = null, $template = null)
    {
        try {
            $mode = null !== $this->getMode() ? $this->getMode() : $this->_object->getMode();
            $this->templateFile = $template;
            if (null === $this->templateFile && null !== $this->_object) {
                $this->templateFile = $this->getTemplateFile($this->_object, $mode);
                if (false === $this->templateFile) {
                    $this->templateFile = $this->getTemplateFile($this->_object, $this->getMode());
                }

                if (false === $this->templateFile && false === $this->_ignoreIfRenderModeNotAvailable) {
                    $this->templateFile = $this->getTemplateFile($this->_object);
                }
            }

            if (false === $this->isValidTemplateFile($this->templateFile)) {
                throw new RendererException(sprintf(
                        'Unable to find file \'%s\' in path (%s)', $template, implode(', ', $this->_scriptdir)
                ), RendererException::SCRIPTFILE_ERROR);
            }
        } catch (RendererException $e) {
            $render = '';

            // Unknown template, try to render subcontent
            if (null !== $this->_object && is_array($this->_object->getData())) {
                foreach ($this->_object->getData() as $subcontents) {
                    $subcontents = (array) $subcontents;

                    foreach ($subcontents as $sc) {
                        if ($sc instanceof RenderableInterface) {
                            $scRender = $this->render(
                                $sc, $this->getMode(), $params, $template, $this->_ignoreIfRenderModeNotAvailable
                            );

                            if (false === $scRender) {
                                throw $e;
                            }

                            $render .= $scRender;
                        }
                    }
                }
            }

            return $render;
        }

        $application = $this->getApplication();
        // Assign vars and parameters
        if (null !== $this->_object) {
            $draft = $this->_object->getDraft();
            $aClassContentClassname = 'BackBee\ClassContent\AbstractClassContent';
            if ($this->_object instanceof $aClassContentClassname && !$this->_object->isLoaded()) {
                // trying to refresh unloaded content
                $em = $application->getEntityManager();

                $classname = get_class($this->_object);
                $uid = $this->_object->getUid();

                $em->detach($this->_object);
                $object = $em->find($classname, $uid);
                if (null !== $object) {
                    $this->_object = $object;
                    if (null !== $draft) {
                        $this->_object->setDraft($draft);
                    }
                }
            }

            $this->assign($this->_object->getData());
            $this->setParam($this->_object->getAllParams());
        }

        if (null !== $application) {
            $application->debug(sprintf(
                'Rendering content `%s(%s)`.',
                get_class($this->_object),
                $this->_object->getUid()
            ));
        }

        return $this->renderTemplate();
    }
1235131
public function render($filename, array $params = array())
    {
        $this->properties = $params;

        $file = $this->scriptPath.DIRECTORY_SEPARATOR.$filename;
        if (!file_exists($file)) {
            $this->logger->error('Could not find template '.$file);

            return '';
        }
        ob_start();
        include $file;

        return ob_get_clean();
    }
1017935
public function render()
    {
        $params     = isset($this->params['attributes']) ? $this->params['attributes'] : $this->params;
        $id         = !isset($params['id']) ? $params['name'] . '-' . str_random(4) : $params['id'];
        $script     = $this->script($id, $params);
        $attributes = app('html')->decorate(array_except($params + ['id' => $id], ['pluginOptions', 'options']));


        $optionsData = array_get($this->params, 'optionsData', []);
        $control     = app('form')->select(
                array_get($this->params, 'name'), array_get($this->params, 'options', []), array_get($this->params, 'value'), $attributes, $optionsData
        );
        echo view('antares/html::controls.remote_select', ['control' => $control])->render();
        if (app('request')->ajax()) {
            echo '<script type="text/javascript">' . $script . '</script>';
        } else {
            app('antares.asset')->container('antares/foundation::scripts')->inlineScript('remote-select-' . $id, $script);
        }
        return '';
    }
1101329
public function asset_render($params) {
        $group = isset($params['group']) ? $params['group'] : null;
        $raw = isset($params['raw']) ? $params['raw'] : false;
        return Asset::render($group, $raw);
    }