Returns data to render template.

@param array $options

@throws WidgetException

@return array
162753
public function getData($options)
    {
        if (!empty($options) &&
            array_key_exists('contact', $options) &&
            !empty($options['contact'])
        ) {
            $id = $options['contact'];
            $contact = $this->contactRepository->find($id);

            if (!$contact) {
                throw new WidgetEntityNotFoundException(
                    'Entity ' . $this->contactRepository->getClassName() . ' with id ' . $id . ' not found!',
                    $this->widgetName,
                    $id
                );
            }

            return $this->parseMainContact($contact);
        }

        return null;
    }
536579
public function render(array $options = []) {
		$id = $this->_getId();

		$html = $this->control($options);
		$html .= $this->Form->control('captcha_id', ['type' => 'hidden', 'value' => $id]);

		$html .= $this->passive();

		return $html;
	}
4997
public function getData(array $options)
    {
        $provider = $this->getProvider();

        $ownerDetails = $provider->getResourceOwner($this->accessToken);

        $ownerDetailsArray = $ownerDetails->toArray();

        $email = null;
        if (isset($ownerDetailsArray['emails']) && is_array($ownerDetailsArray['emails'])) {
            foreach ($ownerDetailsArray['emails'] as $value) {
                if ($value['value']) {
                    $email = $value['value'];
                    break;
                }
            }
        }

        $location = null;
        if (isset($ownerDetailsArray['placesLived']) && is_array($ownerDetailsArray['placesLived'])) {
            foreach ($ownerDetailsArray['placesLived'] as $value) {
                if ($value['value']) {
                    $location = $value['value'];
                    break;
                }
            }
        }

        $birthday = null;
        if (isset($ownerDetailsArray['birthday']) && $ownerDetailsArray['birthday']) {
            $birthday = DateTime::createFromFormat('Y-m-d', $ownerDetailsArray['birthday']);
        }

        $photoUrl = $ownerDetailsArray['image']['url'];
        if ($photoUrl) {
            $photoUrl = $this->removeSizeParam($photoUrl);
        }

        return new Result([
            'externalId' => $ownerDetailsArray['id'],
            'name'       => $ownerDetailsArray['displayName'],
            'profileUrl' => isset($ownerDetailsArray['url']) ? $ownerDetailsArray['url'] : null,
            'photoUrl'   => $photoUrl,
            'email'      => $email,
            'gender'     => isset($ownerDetailsArray['gender']) ? $ownerDetailsArray['gender'] : null,
            'language'   => $ownerDetailsArray['language'],
            'location'   => $location,
            'birthday'   => $birthday
        ]);
    }
122939
public function render($options = array())
    {
        $options = array_merge($this->defaultOptions, $options);
        return $this->view->make('shareable::twitter', array('options' => $options));
    }
957274
public static function render($options) {
        $jsExpressions = array();
        //Replace any js expression with random strings so we can switch
        //them back after json_encode the options
        $optionsJsExpr = static::replaceJsExpr($options, $jsExpressions);
        //TODO: Check for encoding errors
        $result = json_encode($optionsJsExpr);
        //Replace any js expression on the json_encoded string
        foreach ($jsExpressions as $key => $expr) {
            $result = str_replace('"' . $key . '"', $expr, $result);
        }
        return $result;
    }
195197
public function getData(array $options)
    {
        $provider = $this->getProvider();

        $ownerDetails = $provider->getResourceOwner($this->accessToken);

        $json = $ownerDetails->toArray();

        $data = [
            'externalId' => null,
            'name'       => null,
            'profileUrl' => null,
            'photoUrl'   => null,
            'birthday'   => null,
            'email'      => null,
            'gender'     => null,
            'location'   => null,
            'language'   => null
        ];
        if (isset($json['id']) && $json['id']) {
            $data['externalId'] = $json['id'];
            $data['photoUrl'] = sprintf($this->imageUrlTemplate, $json['id']);
        }
        if (isset($json['name']) && $json['name']) {
            $data['name'] = $json['name'];
        }
        if (isset($json['link']) && $json['link']) {
            $data['profileUrl'] = $json['link'];
        }
        if (isset($json['birthday']) && $json['birthday']) {
            $data['birthday'] = DateTime::createFromFormat('m/d/Y', $json['birthday']);
        }
        if (isset($json['email']) && $json['email']) {
            $data['email'] = $json['email'];
        }
        if (isset($json['gender']) && $json['gender']) {
            $data['gender'] = $json['gender'];
        }
        if (isset($json['location']['name']) && $json['location']['name']) {
            $data['location'] = $json['location']['name'];
        }
        if (isset($json['hometown']['name']) && $json['hometown']['name']) {
            $data['location'] = $json['hometown']['name'];
        }
        if (isset($json['locale']) && $json['locale']) {
            $data['language'] = Locale::getPrimaryLanguage($json['locale']);
        }
        return new Result($data);
    }
928465
public function getData(Options $options = null)
    {
        if ($options === null) {
            $options = $this->getOptions();
        }

        $select = $this->assignOptions(clone $this->getSelect(), $options);

        $sql = new Sql($this->adapter);

        $sql_string = $sql->buildSqlString($select);
        //echo $this->select->getSqlString($this->adapter->getPlatform());
        //echo "----" . var_dump($sql_string) . "----\n";
        // In ZF 2.3.0 an empty query will return SELECT .*
        // In ZF 2.4.0 and empty query will return SELECT *
        if (in_array($sql_string, ['', 'SELECT .*', 'SELECT *'], true)) {
            throw new Exception\EmptyQueryException(__METHOD__ . ': Cannot return data of an empty query');
        }
        $this->query_string = $sql_string;

        try {
            $results = $this->adapter->query($sql_string, Adapter::QUERY_MODE_EXECUTE);
            //$stmt = $sql->prepareStatementForSqlObject( $select );
            //$results = $stmt->execute();
            //var_dump(get_class($results));

            $r = new ResultSet($results);
            $r->setSource($this);
            $r->setHydrationOptions($options->getHydrationOptions());

            if ($options->hasLimit() && $options->getLimit() > 0) {
                //$row = $this->adapter->query('select FOUND_ROWS() as total_count')->execute()->current();
                $row = $this->adapter->createStatement('select FOUND_ROWS() as total_count')->execute()->current();
                $r->setTotalRows($row['total_count']);
            } else {
                $r->setTotalRows($r->count());
            }
        } catch (\Exception $e) {
            throw new Exception\ErrorException(__METHOD__ . ': Cannot retrieve data (' . $e->getMessage() . ')');
        }

        return $r;
    }
393908
public function render($template, $options = array())
  {
    $pre_render = view($template, $options);
    $md = new \Parsedown();

    return $md->text($pre_render);
  }
923448
public function renderWidget(Twig_Environment $env, TabPane $tabPane, $options = array(), $template = 'KunstmaanAdminBundle:TabsTwigExtension:widget.html.twig')
    {
        $template = $env->loadTemplate($template);

        return $template->render(array_merge($options, array(
            'tabPane' => $tabPane,
        )));
    }
273709
public function render($template, $data = [], array $options = []) {
		$defaults = ['context' => []];
		$options += $defaults;

		$this->_context = $options['context'] + $this->_context;
		$this->_data = (array) $data + $this->_vars;
		$this->_options = $options;
		$template__ = $template;
		unset($options, $template, $defaults, $data);

		if ($this->_config['extract']) {
			extract($this->_data, EXTR_OVERWRITE);
		} elseif ($this->_view) {
			extract((array) $this->_view->outputFilters, EXTR_OVERWRITE);
		}

		ob_start();
		include $template__;
		return ob_get_clean();
	}
299307
public function prepare($options = [])
    {
        if (request()->ajax()) {
            return $this->getArray($options);
        }

        return $this->getHtml($options);
    }
453103
public function render($opts = []) {
		if ($this->options['render'] && method_exists($this->form, $this->options['render'])) {
			return $this->form->{$this->options['render']}($this, $opts);
		} else {
			$html = $this->renderWidget($opts);
			if ($this->options['wrapper'] && method_exists($this->form, $this->options['wrapper'])) {
				$html = $this->form->{$this->options['wrapper']}($html, $this, $opts);
			}

			return $html;
		}
	}
1363945
public function render(array $options = [])
    {
        if (profiler() !== false) {
            profiler()->watch('Starting View Rendering');
        }

        parser()->loadVars(presenter()->getArrayCopy());

        if (presenter()->page->file instanceof \SplFileInfo) {

            if (false === ($pagePresets = presenter()->page->getPresets())) {
                if (presenter()->page->file->getFilename() === 'index') {
                    $title = presenter()->page->file->getDirectoryInfo()->getDirName();
                } else {
                    $titles[] = presenter()->page->file->getDirectoryInfo()->getDirName();
                    $titles[] = presenter()->page->file->getFilename();

                    $title = implode(' - ', array_unique($titles));
                }

                $pagePresets = new SplArrayObject([
                    'title'  => readable($title, true),
                    'access' => 'public',
                ]);
            }

            /**
             * Sets Page Theme
             */
            if ($pagePresets->offsetExists('theme')) {
                presenter()->setTheme($pagePresets->theme);
            } elseif (false !== ($theme = presenter()->getConfig('theme'))) {
                if (modules()->top()->hasTheme($theme)) {
                    presenter()->setTheme($theme);
                }
            }

            /**
             * Sets Page Layout
             */
            if (presenter()->theme !== false) {
                if ($pagePresets->offsetExists('layout')) {
                    presenter()->theme->setLayout($pagePresets->layout);
                }

                /**
                 * Autoload Theme Assets
                 */
                presenter()->theme->load();

                if (false !== ($modulePresets = modules()->top()->getPresets())) {

                    /**
                     * Autoload Module Assets
                     */
                    if ($modulePresets->offsetExists('assets')) {
                        presenter()->assets->autoload($modulePresets->assets);
                    }

                    /**
                     * Sets Module Meta
                     */
                    if ($modulePresets->offsetExists('title')) {
                        presenter()->meta->title->append(language()->getLine($modulePresets->title));
                    }

                    if ($modulePresets->offsetExists('pageTitle')) {
                        presenter()->meta->title->replace(language()->getLine($modulePresets->pageTitle));
                    }

                    if ($modulePresets->offsetExists('browserTitle')) {
                        presenter()->meta->title->replace(language()->getLine($modulePresets->browserTitle));
                    }

                    if ($modulePresets->offsetExists('meta')) {
                        foreach ($modulePresets->meta as $name => $content) {
                            presenter()->meta->store($name, $content);
                        }
                    }
                }

                $moduleAssets = [
                    'app',
                    'module',
                    modules()->top()->getParameter(),
                ];

                // Autoload Assets
                presenter()->assets->loadCss($moduleAssets);
                presenter()->assets->loadJs($moduleAssets);

                /**
                 * Autoload Page Assets
                 */
                if ($pagePresets->offsetExists('assets')) {
                    presenter()->assets->autoload($pagePresets->assets);
                }

                if (presenter()->page->file instanceof \SplFileInfo) {
                    $pageDir = presenter()->page->file->getRealPath();
                    $pageDir = str_replace('.' . pathinfo($pageDir, PATHINFO_EXTENSION), '', $pageDir);

                    $pageDirParts = explode('pages' . DIRECTORY_SEPARATOR,
                        str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $pageDir));
                    $pageDir = end($pageDirParts);

                    presenter()->assets->addFilePath(reset($pageDirParts) . 'pages' . DIRECTORY_SEPARATOR);

                    $pageDir = rtrim($pageDir, DIRECTORY_SEPARATOR);
                    $pageDirParts = explode(DIRECTORY_SEPARATOR, $pageDir);

                    $totalParts = count($pageDirParts);

                    for ($i = 0; $i < $totalParts; $i++) {
                        $pageAssets[] = implode(DIRECTORY_SEPARATOR, array_slice($pageDirParts, 0, ($totalParts - $i)));
                    }

                    $pageAssets[] = implode(DIRECTORY_SEPARATOR, [end($pageAssets), end($pageAssets)]);

                    // Autoload Assets
                    presenter()->assets->loadCss($pageAssets);
                    presenter()->assets->loadJs($pageAssets);
                }

                /**
                 * Sets Page Meta
                 */
                if ($pagePresets->offsetExists('title')) {
                    presenter()->meta->title->append(language()->getLine($pagePresets->title));
                }

                if ($pagePresets->offsetExists('pageTitle')) {
                    presenter()->meta->title->replace(language()->getLine($pagePresets->pageTitle));
                }

                if ($pagePresets->offsetExists('browserTitle')) {
                    presenter()->meta->title->replace(language()->getLine($pagePresets->browserTitle));
                }

                if ($pagePresets->offsetExists('meta')) {
                    foreach ($pagePresets->meta as $name => $content) {
                        presenter()->meta->store($name, $content);
                    }
                }

                if (false !== ($layout = presenter()->theme->getLayout())) {
                    parser()->loadFile($layout->getRealPath());

                    $htmlOutput = parser()->parse();
                    $htmlOutput = presenter()->assets->parseSourceCode($htmlOutput);

                    $this->document->loadHTML($htmlOutput);
                }
            } else {
                output()->sendError(204, language()->getLine('E_THEME_NOT_FOUND', [$theme]));
            }
        } elseif (presenter()->theme instanceof Theme) {
            /**
             * Autoload Theme Assets
             */
            presenter()->theme->load();

            if (false !== ($modulePresets = modules()->top()->getPresets())) {

                /**
                 * Autoload Module Assets
                 */
                if ($modulePresets->offsetExists('assets')) {
                    presenter()->assets->autoload($modulePresets->assets);
                }

                /**
                 * Sets Module Meta
                 */
                if ($modulePresets->offsetExists('title')) {
                    presenter()->meta->title->append(language()->getLine($modulePresets->title));
                }

                if ($modulePresets->offsetExists('pageTitle')) {
                    presenter()->meta->title->replace(language()->getLine($modulePresets->pageTitle));
                }

                if ($modulePresets->offsetExists('browserTitle')) {
                    presenter()->meta->title->replace(language()->getLine($modulePresets->browserTitle));
                }

                if ($modulePresets->offsetExists('meta')) {
                    foreach ($modulePresets->meta as $name => $content) {
                        presenter()->meta->store($name, $content);
                    }
                }
            }

            $moduleAssets = [
                'app',
                'module',
                modules()->top()->getParameter(),
            ];

            // Autoload Assets
            presenter()->assets->loadCss($moduleAssets);
            presenter()->assets->loadJs($moduleAssets);

            /**
             * Autoload Controller Assets
             */
            $controllerFilename = str_replace([modules()->top()->getDir('Controllers'), '.php'], '',
                controller()->getFileInfo()->getRealPath());
            $controllerFilename = dash($controllerFilename);
            $controllerAssets[] = $controllerFilename;
            $controllerAssets[] = implode('/', [
                $controllerFilename,
                controller()->getRequestMethod(),
            ]);

            presenter()->assets->loadCss($controllerAssets);
            presenter()->assets->loadJs($controllerAssets);

            if (false !== ($layout = presenter()->theme->getLayout())) {
                parser()->loadFile($layout->getRealPath());

                $htmlOutput = parser()->parse();
                $htmlOutput = presenter()->assets->parseSourceCode($htmlOutput);

                $this->document->loadHTML($htmlOutput);
            }
        } elseif (false !== ($theme = presenter()->getConfig('theme'))) {
            if (modules()->top()->hasTheme($theme)) {
                presenter()->setTheme($theme);

                /**
                 * Autoload Theme Assets
                 */
                presenter()->theme->load();

                if (false !== ($modulePresets = modules()->top()->getPresets())) {

                    /**
                     * Autoload Module Assets
                     */
                    if ($modulePresets->offsetExists('assets')) {
                        presenter()->assets->autoload($modulePresets->assets);
                    }

                    /**
                     * Sets Module Meta
                     */
                    if ($modulePresets->offsetExists('title')) {
                        presenter()->meta->title->append(language()->getLine($modulePresets->title));
                    }

                    if ($modulePresets->offsetExists('pageTitle')) {
                        presenter()->meta->title->replace(language()->getLine($modulePresets->pageTitle));
                    }

                    if ($modulePresets->offsetExists('browserTitle')) {
                        presenter()->meta->title->replace(language()->getLine($modulePresets->browserTitle));
                    }

                    if ($modulePresets->offsetExists('meta')) {
                        foreach ($modulePresets->meta as $name => $content) {
                            presenter()->meta->store($name, $content);
                        }
                    }
                }

                $moduleAssets = [
                    'app',
                    'module',
                    modules()->top()->getParameter(),
                ];

                // Autoload Assets
                presenter()->assets->loadCss($moduleAssets);
                presenter()->assets->loadJs($moduleAssets);

                /**
                 * Autoload Controller Assets
                 */
                $controllerFilename = str_replace([modules()->top()->getDir('Controllers'), '.php'], '',
                    controller()->getFileInfo()->getRealPath());
                $controllerFilename = dash($controllerFilename);
                $controllerAssets[] = $controllerFilename;
                $controllerAssets[] = implode('/', [
                    $controllerFilename,
                    controller()->getRequestMethod(),
                ]);

                if (false !== ($layout = presenter()->theme->getLayout())) {
                    parser()->loadFile($layout->getRealPath());

                    $htmlOutput = parser()->parse();
                    $htmlOutput = presenter()->assets->parseSourceCode($htmlOutput);

                    $this->document->loadHTML($htmlOutput);
                }
            } else {
                output()->sendError(204, language()->getLine('E_THEME_NOT_FOUND', [$theme]));
            }
        } else {
            $this->document->find('body')->append(presenter()->partials->__get('content'));
        }

        /**
         * Set Document Meta Title
         */
        if (presenter()->meta->title instanceof Meta\Title) {
            $this->document->title->text(presenter()->meta->title->__toString());
        }

        /**
         * Injecting Meta Opengraph
         */
        if (presenter()->meta->opengraph instanceof Meta\Opengraph) {
            // set opengraph title
            if (presenter()->meta->title instanceof Meta\Title) {
                presenter()->meta->opengraph->setTitle(presenter()->meta->title->__toString());
            }

            // set opengraph site name
            if (presenter()->exists('siteName')) {
                presenter()->meta->opengraph->setSiteName(presenter()->offsetGet('siteName'));
            }

            if (presenter()->meta->opengraph->count()) {
                $htmlElement = $this->document->getElementsByTagName('html')->item(0);
                $htmlElement->setAttribute('prefix', 'og: ' . presenter()->meta->opengraph->prefix);

                if (presenter()->meta->opengraph->exists('og:type') === false) {
                    presenter()->meta->opengraph->setType('website');
                }

                $opengraph = presenter()->meta->opengraph->getArrayCopy();

                foreach ($opengraph as $tag) {
                    $this->document->metaNodes->createElement($tag->attributes->getArrayCopy());
                }
            }
        }

        if (presenter()->meta->count()) {
            $meta = presenter()->meta->getArrayCopy();

            foreach ($meta as $tag) {
                $this->document->metaNodes->createElement($tag->attributes->getArrayCopy());
            }
        }

        /**
         * Inject body attributes
         */
        $body = $this->document->getElementsByTagName('body');
        $body->item(0)->setAttribute('module', modules()->top()->getParameter());

        /**
         * Injecting Single Sign-On (SSO) iFrame
         */
        if (services()->has('user')) {
            $iframe = services()->get('user')->getIframeCode();

            if ( ! empty($iframe)) {
                $this->document->find('body')->append($iframe);
            }
        }

        if (input()->env('DEBUG_STAGE') === 'DEVELOPER' and
            presenter()->getConfig('debugToolBar') === true and
            services()->has('profiler')
        ) {
            $this->document->find('body')->append((new Toolbar())->__toString());
        }

        /**
         * Injecting Progressive Web Application (PWA) Manifest
         */
        $this->document->linkNodes->createElement([
            'rel'  => 'manifest',
            'href' => '/manifest.json',
        ]);

        $htmlOutput = $this->document->saveHTML();

        // Uglify Output
        if ($this->config->output[ 'uglify' ] === true) {
            $htmlOutput = preg_replace(
                [
                    '/\>[^\S ]+/s',     // strip whitespaces after tags, except space
                    '/[^\S ]+\</s',     // strip whitespaces before tags, except space
                    '/(\s)+/s',         // shorten multiple whitespace sequences
                    '/<!--(.|\s)*?-->/', // Remove HTML comments
                    '/<!--(.*)-->/Uis',
                    "/[[:blank:]]+/",
                ],
                [
                    '>',
                    '<',
                    '\\1',
                    '',
                    '',
                    ' ',
                ],
                str_replace(["\n", "\r", "\t"], '', $htmlOutput));
        }

        // Beautify Output
        if ($this->config->output[ 'beautify' ] === true) {
            $beautifier = new Html\Dom\Beautifier();
            $htmlOutput = $beautifier->format($htmlOutput);
        }

        if (profiler() !== false) {
            profiler()->watch('Ending View Rendering');
        }

        return $htmlOutput;
    }
1177566
public function getWidgetImages($language_model, array $options)
    {
        $options += array(
            'single' => false,
            'languages' => $language_model->getList(array('in_database' => true))
        );

        return $this->render('common/image', $options);
    }
303247
public function renderLabel(array $options = [])
    {
        $attrs['id'] = $this->getAttribute('labelId', $this->getId() . '-label');
        $attrs['class'] = $this->getAttribute('labelClass');
        $attrs['for'] = $this->getAttribute('for', $this->getId());
        $attrs['title'] = $this->getAttribute('description');

        $attrs = array_merge($attrs, (array) $this->getAttribute('labelAttribs'));

        if ($this->form && $this->form->getRenderer()) {
            return $this->form->getRenderer()->renderLabel($this, $attrs, $options);
        }

        $label = $this->getLabel();

        if ($this->required) {
            $label = '<span class="windwalker-input-required-hint">*</span> ' . $label;
        }

        return (string) new HtmlElement('label', $label, $attrs);
    }
246321
public function render()
    {
        try {
            $this->vars['registrations'] = $this->loadData();

        } catch (Exception $ex) {
            $this->vars['error'] = $ex->getMessage();
            $this->vars['registrations'] = [];
        }

        return $this->makePartial('widget');
    }
697123
public function getWidgetPager(array $options)
    {
        $options += array(
            'key' => 'p',
            'page' => 1,
            'template' => 'common/pager',
            'query' => $this->getQuery(null, array(), 'array')
        );

        if (isset($options['query'][$options['key']])) {
            $options['page'] = (int) $options['query'][$options['key']];
        }

        $options['query'][$options['key']] = '%num';

        $data = array(
            'options' => $options,
            'pager' => $this->pager->build($options)->get()
        );

        return $this->render($options['template'], $data);
    }