Render an accordion

@param mixed $items
@param array $options
@return string
193681
public function accordion($items = array(), $options = array()) {
		$defaults = array(
			'class' => '', 'id' => str_replace('.', '', uniqid('accordion_', true)),
		);
		$options = Hash::merge($defaults, $options);
		$options = $this->addClass($options, 'panel-group');

		if (is_array($items)) {
			$html = '';
			foreach ($items as $itemHeading => $itemBody) {
				$html .= $this->accordionItem($itemHeading, $itemBody, array('accordionId' => $options['id']));
			}
		} else {
			$html= $items;
		}

		return $this->tag('div', $html, $options);
	}
831576
public function renderItems($items)
    {
        $result = '';

        // loop over subjects
        $subjectArray = [];
        foreach ($items as $subject => $subjectStatements) {
            $subjectString = $this->turtleString($subject)."\n\t";

            // loop over predicates
            $predicateArray = [];
            foreach ($subjectStatements as $predicate => $objects) {
                $predicateString = $this->turtleString($predicate).' ';

                // loop over objects
                $objectArray = [];
                foreach ($objects as $object => $properties) {
                    $objectString = '';
                    if (null === $properties) {
                        $objectString = $this->turtleString($object);
                    } else {
                        if (false === strpos($object, '"') && false === strpos($object, "\r") && false === strpos($object,
                                "\n")
                        ) {
                            $objectString = '"'.$object.'"';
                        } else {
                            if (false === strpos($object, '"""')) {
                                $objectString = '"""'.$object.'"""';
                            } else {
                                if (false === strpos($object, "'''")) {
                                    $objectString = "'''".$object."'''";
                                } else {
                                    // TODO: Error Handling for could not escape.
                                }
                            }
                        }
                        if ($properties['language']) {
                            $objectString .= '@'.$properties['language'];
                        }
                        if ($properties['type']) {
                            $objectString .= '^^'.$this->turtleString($properties['type']);
                        }
                    }
                    $objectArray[] = $objectString;
                }
                $predicateString .= implode(', ', $objectArray);
                $predicateArray[] = $predicateString;
            }

            $subjectString .= implode(" ;\n\t", $predicateArray);
            $subjectArray[] = $subjectString;
        }
        $result .= implode(' .'.PHP_EOL.PHP_EOL, $subjectArray).' .'.PHP_EOL;

        // Prepend the prefixes that are used.
        $prefixes = [];
        foreach ($this->prefixes as $acronym => $prefix) {
            if (true === $this->usedPrefixes[$acronym]) {
                $prefixes[] = '@prefix '.$acronym.': '.$this->turtleString($prefix, false).' .'.PHP_EOL;
            }
        }

        $result = PHP_EOL.implode('', $prefixes).PHP_EOL.$result;

        return $result;
    }
122939
public function render($options = array())
    {
        $options = array_merge($this->defaultOptions, $options);
        return $this->view->make('shareable::twitter', array('options' => $options));
    }
270018
public static function render($options = null)
	{
		$pagination = new static($options);

		if (!$links = $pagination->getLinks())
		{
			return '';
		}

		if (!$pagination->view)
		{
			return $pagination->autoRender($links);
		}

		return $pagination->renderView($links);

	}
553699
protected function renderItems($items) {
		
		foreach ($items as $i => $item) {
			if (!is_array($item)) {
				continue;
			}

			if (isset($item['visible']) && $item['visible'] === false) {
				continue;
			}

			if (!isset($item['itemOptions'])) {
				$item['itemOptions'] = array();
			}

			$classes = array('item');

			if ($i === 0) {
				$classes[] = 'active';
			}

            $classes = implode(' ', $classes);
            if (isset($item['itemOptions']['class'])) {
                $item['itemOptions']['class'] .= ' ' . $classes;
            } else {
                $item['itemOptions']['class'] = $classes;
            }

			echo CHtml::openTag('div', $item['itemOptions']);

			if (isset($item['image'])) {
				if (!isset($item['alt'])) {
					$item['alt'] = '';
				}

				if (!isset($item['imageOptions'])) {
					$item['imageOptions'] = array();
				}

                /**
                 * Is this image should be a link?
                 * @since 2.1.0
                 */
                if (isset($item['link'])) {
                    // Any kind of link options
                    if (!isset($item['linkOptions']) || !is_array($item['linkOptions'])) {
                        $item['linkOptions'] = array();
                    }

                    // URL
                    if(is_array($item['link'])) {
                        $route = isset($item['link'][0]) ? $item['link'][0] : '';
                        $item['linkOptions']['href'] = Yii::app()->createUrl($route, array_splice($item['link'], 1));
                    } else {
                        $item['linkOptions']['href'] = $item['link'];
                    }

                    // Print out 'A' tag
                    echo CHtml::openTag('a', $item['linkOptions']);
                }

				echo CHtml::image($item['image'], $item['alt'], $item['imageOptions']);

                if (isset($item['link'])) {
                    echo '</a>';
                }
			}

			if (!empty($item['caption']) && (isset($item['label']) || isset($item['caption']))) {
				if (!isset($item['captionOptions'])) {
					$item['captionOptions'] = array();
				}

				if (isset($item['captionOptions']['class'])) {
					$item['captionOptions']['class'] .= ' carousel-caption';
				} else {
					$item['captionOptions']['class'] = 'carousel-caption';
				}

				echo CHtml::openTag('div', $item['captionOptions']);

				if (isset($item['label'])) {
					echo '<h3>' . $item['label'] . '</h3>';
				}

				if (isset($item['caption'])) {
					echo '<p>' . $item['caption'] . '</p>';
				}

				echo '</div>';
			}
			echo '</div>';
		}
	}
402052
public function renderItems($items)
    {
        $graph = [];

        // loop over subjects
        foreach ($items as $subjectURI => $subjectStatements) {
            $subject = ['@id' => $this->prefixedName($subjectURI)];

            // loop over predicates
            foreach ($subjectStatements as $predicateURI => $objects) {
                // loop over objects
                foreach ($objects as $objectString => $properties) {
                    if (null === $properties) {
                        $object = $this->prefixedName($objectString);
                    } else {
                        $object = ['@value' => $objectString];

                        if ($properties['language']) {
                            $object['@language'] = $properties['language'];
                        }
                        if ($properties['type']) {
                            $object['@type'] = $properties['type'];
                        }
                    }

                    $predicateURI = $this->prefixedName($predicateURI);
                    if ($subject[$predicateURI]) {
                        if (is_array($subject[$predicateURI])) {
                            $subject[$predicateURI][] = $object;
                        } else {
                            $subject[$predicateURI] = [$subject[$predicateURI], $object];
                        }
                    } else {
                        $subject[$predicateURI] = $object;
                    }
                }
            }

            $graph[] = $subject;
        }

        // Add the prefixes as the @context.
        $context = [];
        foreach (array_keys($this->usedPrefixes) as $prefix) {
            if ($this->prefixes[$prefix]) {
                $context[$prefix] = $this->prefixes[$prefix];
            }
        }

        return json_encode([
            '@context' => $context,
            '@graph' => $graph,
        ]);
    }
10441
public function render(array $options = [])
    {
        $output = '';

        if ($this->count()) {
            foreach ($this->storage as $key => $value) {
                $output = trim($output);
                switch ($key) {
                    case 'style':
                        if (count($value) == 0) {
                            continue;
                        }

                        $output .= 'style="';
                        foreach ($value as $styleKey => $styleValue) {
                            $output .= $styleKey . ':' . $styleValue . ';';
                        }
                        $output .= '"';

                        break;
                    case 'class':
                        if (count($value) == 0) {
                            continue;
                        }
                        $output .= ' ' . $key . '="' . implode(' ', $value) . '"';
                        break;
                    case 'js':
                        $output .= ' ' . $key . '="' . $value . '"';
                        break;
                    default:
                        if (is_array($value)) {
                            if (count($value) == 0) {
                                continue;
                            }
                            $value = implode(', ', $value);
                        }

                        if (is_bool($value)) {
                            $value = $value === true ? 'true' : 'false';
                        }

                        if (in_array($key, [
                            'controls',
                            'disabled',
                            'readonly',
                            'autocomplete',
                            'checked',
                            'loop',
                            'autoplay',
                            'muted',
                        ])) {
                            $output .= ' ' . $key;
                        } else {
                            $output .= ' ' . $key . '="' . $value . '"';
                        }
                        break;
                }
            }
        }

        return $output;
    }
1189745
protected function _renderItem(ItemInterface $item, array $options)
    {
        if (!$item->isDisplayed()) {
            return '';
        }

        $level = $item->getLevel();

        $class = (array)$item->getAttribute('class');

        if ($this->_matcher->isCurrent($item)) {
            $class[] = $options['currentClass'];
        } elseif (isset($options['ancestorClass']) &&
            $this->_matcher->isAncestor($item, $options['matchingDepth'])
        ) {
            $class[] = $options['ancestorClass'];
        }

        if (isset($options['firstClass']) &&
            $item->actsLikeFirst()
        ) {
            $class[] = $options['firstClass'];
        }
        if (isset($options['lastClass']) &&
            $item->actsLikeLast()
        ) {
            $class[] = $options['lastClass'];
        }

        $hasChildren = $item->hasChildren();
        if ($hasChildren &&
            $options['depth'] !== 0
        ) {
            if ($options['branchClass'] !== null &&
                $item->getDisplayChildren()
            ) {
                $class[] = $options['branchClass'];
            }
        } elseif ($options['leafClass'] !== null) {
            $class[] = $options['leafClass'];
        }

        $attributes = $item->getAttributes();
        if (!empty($class)) {
            $attributes['class'] = implode(' ', $class);
        }

        $templater = $this->templater();

        $attributes = $this->_formatAttributes($attributes, $item);

        $templates = (array)$item->getExtra('templates');
        $defaultTemplates = (array)$item->getExtra('defaultTemplates');
        $newTemplates = $templates + $defaultTemplates;
        if ($newTemplates) {
            $templater->push();
            $templater->add($newTemplates);
        }

        $templateVars = (array)$item->getExtra('templateVars');
        $defaultTemplateVars = (array)$item->getExtra('defaultTemplateVars');
        $currentDefaultTemplateVars = (array)$options['defaultTemplateVars'];
        $templateVars =
            $templateVars +
            $defaultTemplateVars +
            $currentDefaultTemplateVars;
        if (empty($templateVars)) {
            $templateVars = null;
        }
        $options['templateVars'] = $templateVars;

        $link = $this->_renderLink($item, $options);

        if ($hasChildren) {
            $nestedClass = (array)$item->getChildrenAttribute('class');
            if ($options['menuLevelClass'] !== null) {
                $nestedClass[] = $options['menuLevelClass'] . $level;
            }
            if ($options['nestedMenuClass'] !== null) {
                $nestedClass[] = $options['nestedMenuClass'];
            }
            $nestedAttributes = $item->getChildrenAttributes();
            $nestedAttributes['class'] = implode(' ', $nestedClass);
            $options['attributes'] = $nestedAttributes;

            $options['childrenTemplates'] = null;
            if ($newTemplates) {
                // item defines new templates that must be ignored by the children
                $options['childrenTemplates'] = $options['defaultTemplates'];
            }
            if ($defaultTemplates) {
                // item defines default templates that must be used by the children
                $options['childrenTemplates'] = $defaultTemplates;
            }

            if ($defaultTemplateVars) {
                // item defines default template vars that must be used by the children
                $options['defaultTemplateVars'] =
                    $defaultTemplateVars +
                    $currentDefaultTemplateVars;
            }

            $nested = $this->_renderNested($item, $options);
        } else {
            $nested = '';
        }

        $rendered = (string)$templater->format('item', [
            'attrs' => $attributes,
            'templateVars' => $templateVars,
            'link' => $link,
            'nest' => $nested
        ]);

        if ($newTemplates) {
            $templater->pop();
        }

        return $rendered;
    }
766248
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $options = ArrayHelper::getValue($item, 'options', ['class'=>'btn btn-sm']);
        $url = ArrayHelper::getValue($item, 'url', '#');

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if ($active) {
            Html::addCssClass($options, 'btn-info');
        } else {
            Html::addCssClass($options, 'btn-default');
        }

        return Html::a($label, $url, $options);
    }
1062301
protected function buildCollapsibleBody($items = [])
    {
        $html[] = Html::beginTag('ul');

        foreach ($items as $item) {
            $url = ArrayHelper::getValue($item, 'url', null);
            $label = ArrayHelper::getValue($item, 'label', '');
            $options = ArrayHelper::getValue($item, 'options', []);
            $link = Html::a($label, $url, $options);
            $html[] = Html::tag('li', $link);
        }

        $html[] = Html::endTag('ul');
        return implode("\n", $html);
    }
620261
public function render($items)
    {
        $wrappers = '';

        foreach ($items as $item) {
            $wrapper = new MenuWrapper($this->config(), $this->_here);
            $wrappers .= $wrapper->render($item);
            $this->_active = $this->_active || $wrapper->active();
        }

        $this->config('group.group', $wrappers);
        return $this->formatTemplate('group', $this->config('group'));
    }
1173860
protected function renderAsItems($items) {
    $lines = [];
    foreach ($items as $i => $item) {
      if (isset($item['visible']) && !$item['visible']) {
        unset($items[$i]);
        continue;
      }
      if (is_string($item)) {
        $lines[] = $item;
        continue;
      }
      if (!isset($item['label'])) {
        throw new InvalidConfigException("The 'label' option is required.");
      }

      $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
      $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
      $options = ArrayHelper::getValue($item, 'options', []);
      $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
      $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
      $lines[] = Html::tag('li', $content, $options);
    }

    return implode("\n", $lines);
  }
415939
protected function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }
        $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $listItemOptions = ArrayHelper::getValue($item, 'options', []);
        $items = ArrayHelper::getValue($item, 'items');
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);

        if (isset($item['active'])) {
            $active = ArrayHelper::remove($item, 'active', false);
        } else {
            $active = $this->isItemActive($item);
        }

        if (empty($items)) {
            $content = Html::a($label, $url, $linkOptions);
        } else {
            Html::addCssClass($listItemOptions, ['widget' => 'submenu']);
            Html::addCssClass($linkOptions, ['widget' => 'submenu-opener']);
            if ($this->dropDownCaret !== '') {
                $label .= ' ' . $this->dropDownCaret;
            }
            if (is_array($items)) {
                if ($this->activateItems) {
                    $items = $this->isChildActive($items, $active);
                }
                $items = $this->renderCollapsible(Html::a($label, $url, $linkOptions), $items, $active);
            }
            $content = $items;
        }


        if ($this->activateItems && $active) {
            Html::addCssClass($listItemOptions, 'active');
        }

        return Html::tag('li', $content, $listItemOptions);
    }
1152937
public function render($options = [ ])
    {
        $mergedOptions = array_merge($this->config['options'], $options);

        $data = [
            'public_key' => value($this->config['public_key']),
            'options'    => $mergedOptions,
            'dataParams' => $this->extractDataParams($mergedOptions),
        ];

        if (array_key_exists('lang', $mergedOptions) && "" !== trim($mergedOptions['lang'])) {
            $data['lang'] = $mergedOptions['lang'];
        }

        $view = $this->getView($options);

        return app('view')->make($view, $data);
    }
245109
public function render(ItemInterface $item, array $options = array())
    {
        $options = array_merge($this->defaultOptions, $options);

        $template = $options['template'];
        if (!$template instanceof \Twig_Template) {
            $template = $this->environment->loadTemplate($template);
        }

        $data = $this->getData($item);

        $html = $template->renderBlock($options['block'], array(
            'item'    => $data,
            'options' => $options,
            'matcher' => $this->matcher
        ));

        if (!empty($options['clear_matcher'])) {
            $this->matcher->clear();
        }

        return $html;
    }
641597
public function ul($items = false, $parent_id = 0, $first = false)
    {
        $attrs = '';

        if (! $first && is_array($this->optionUlAttr) && count($this->optionUlAttr) > 0) {
            $attrs = $this->renderAttr($this->optionUlAttr, $parent_id);
        }
        else if($first && count($this->firstUlAttrs) > 0) {
            $attrs = $this->renderAttr($this->firstUlAttrs, $parent_id);
        }

        if (!$items) {
            return "\n".'<ul'.$attrs.'>'."\n";
        }

        return '<ul'.$attrs.'>'."\n".$items."\n".'</ul>';
    }
1018386
public function render(array $options = []): string
    {
        $html = $this->format['menuStart'];
        $html .= !empty($options['title']) ? $options['title'] : '';

        /**
         * @var MenuItemInterface $menuItem
         */
        foreach ($this->menu->getMenuItems() as $menuItem) {
            if ($menuItem->isEnabled()) {
                $html .= $this->renderMenuItem($menuItem);
            }
        }
        $html .= $this->format['menuEnd'];

        return $html;
    }