生成节点图标

@param string|array $item
@return string the rendering result.
427484
protected function renderItemIcon($item)
    {
        $iconClass = ArrayHelper::getValue($item, 'icon');
        if ($iconClass !== null) {
            $class = [$this->iconClass];
            Html::addCssClass($class, $iconClass);
            return Html::tag('i', '', ['class' => $class]);
        } else {
            return '';
        }
    }
529223
protected function renderIcon(array $item)
    {
        static $rendered = array();

        if (isset($rendered[$item['extension']])) {
            return $rendered[$item['extension']];
        }

        $template = "file_manager|icons/ext/{$item['extension']}";

        if ($item['type'] === 'dir') {
            $template = 'file_manager|icons/dir';
        }

        $data = array('item' => $item);
        $default = $this->controller->render('file_manager|icons/file', $data);
        $rendered[$item['extension']] = $this->controller->render($template, $data, true, $default);

        return $rendered[$item['extension']];
    }
1260855
private function pushStream($item) : string
    {
        $id = uniqid(__FUNCTION__ . mt_rand(), true) . '_';
        $this->streams[$id] = $item; // push

        return $id;
    }
1128284
public function subItem($item = [], $options = [])
    {
        $html = '<li>';
        $html .= $this->Html->link($item['title'], $item['url']);
        $html .= '</li>';

        return $html;
    }
1349039
public function escape(string $item): string
	{
    $items = explode('.', str_replace($this->qte, '', $item));
    $r = [];
    foreach ( $items as $m ){
      if ( !bbn\str::check_name($m) ){
        return false;
      }
      $r[] = $this->qte.$m.$this->qte;
    }
    return implode('.', $r);
	}
1023072
protected function renderItem($item) {
        $linkTemplate = empty($item['items']) ? $this->linkTemplate : $this->itemSubmenuLinkTemplate;
        $labelTemplate = empty($item['items']) ? $this->labelTemplate : $this->itemSubmenuLabelTemplate;

        if (isset($item['url'])) {
            $template = ArrayHelper::getValue($item, 'template', $linkTemplate);

            $params = [
                '{url}' => Html::encode(Url::to($item['url'])),
                '{label}' => $item['label'],
                '{icon}' => isset($item['icon']) ? "<i class='{$item['icon']}'></i>" : '',
            ];

            return strtr($template, $params);
        } else {
            $template = ArrayHelper::getValue($item, 'template', $labelTemplate);

            return strtr($template, [
                '{label}' => $item['label'],
                '{icon}' => isset($item['icon']) ? "<i class='{$item['icon']}'></i>" : '',
            ]);
        }
    }
1186854
protected function renderItem($item = [])
    {
        $tag = ArrayHelper::getValue($item, 'tag', 'div');
        $content = ArrayHelper::getValue($item, 'content', '');
        $options = ArrayHelper::getValue($item, 'options', []);
        $options = ArrayHelper::merge($this->itemOptions, $options);

        Html::addCssClass($options, ['item' => 'carousel-item']);

        return Html::tag($tag, $content, $options);
    }
340049
public static function renderItem(SQL\Columns $item)
    {
        return Compiler::braced(
            Arr::join(', ', Arr::map(__NAMESPACE__.'\Compiler::name', $item->all()))
        );
    }
1197871
private function formAction(array $item)
    {
        $form = array(
            'name' => 'editURL',
            'caption' => ADM_EDIT,
            'width' => '100%',
            'fields' => array(
                array('type' => 'hidden', 'name' => 'update', 'value' => $item['id']),
                array('type' => 'edit', 'name' => 'url', 'label' => 'URL:', 'width' => '100%',
                    'value' => isset($item['content']) ? $item['content'] : ''),
            ),
            'buttons' => array('apply', 'cancel'),
        );
        /** @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $html = $page->renderForm($form);
        return $html;
    }
325896
public function __item($item = null)
    {
        $result['name'] = $this->getName();
        $result['content'] = '0';
        $result['active'] = is_null($item) ? true : $item['active'];
        $result['settings'] = Eresus_CMS::getLegacyKernel()->db->
            escape(is_null($item) ? encodeOptions($this->settings) : $item['settings']);
        $result['title'] = $this->title;
        $result['version'] = $this->version;
        $result['description'] = $this->description;
        return $result;
    }
741254
protected function renderItems( array $items )
    {
        $renderedItems = [ ];
        foreach ($items as $index => $item) {
            $renderedItems[] = $this->renderItem( $item );
        }

        return implode( PHP_EOL, $renderedItems );
    }
518458
protected function generateRenderOptions($item = -1)
	{
		$options = $this->getOptions();

		foreach (($item > -1 ? [$this->getItem($item)] : $this->getItems()) as $model) {
			foreach ($model->getOptions() as $key => $option) {
				if (array_key_exists($key, $this->getOptions()) && $this->getOptions()[$key] !== $option) {
					$options[$key] = $option;
				}
			}
		}

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

        if (ArrayHelper::getValue($item, Enum::STATE_ACTIVE)) {
            ArrayHelper::addValue('class', Enum::STATE_ACTIVE, $options);
        }

        if ($items !== null) {
            Html::addCssClass($options, Enum::DROPDOWN_HAS);
            if (is_array($items)) {
                $items = Nav::dropdown($items, $this->encodeLabels);
            }
        }

        return \CHtml::tag('li', $options, \CHtml::link($label, $url, $linkOptions) . $items);
    }
856333
protected function createFormField($item)
    {
        $required = ($item['required'] === true) ? ", 'required' => 'required'" : "";

        return $this->wrapField(
            $item,
            "{!! Form::" . $this->typeLookup[$item['type']] . "('" . $item['name'] . "', null, ['class' => 'form-control'$required]) !!}"
        );
    }
212161
public function render(Renderable $item)
    {
        $output = '';
        $nl = '';
        $group = $item->group();

        if ($item instanceof AssetContract) {
            return $this->renderAsset($item, $group);
        }

        foreach ($item as $asset) {
            $output .= $nl.$this->renderAsset($asset, $group);
            $nl = "\n";
        }

        return $output;
    }
95372
public function renderItem($item)
    {
        if (is_string($item)) {
            return $item;
        }
        if (!isset($item['label'])) {
            throw new InvalidConfigException("The 'label' option is required.");
        }

        $options = ArrayHelper::getValue($item, 'options', []);
        $active = $this->isItemActive($item);
        if ($this->activateItems && $active) {
            Html::addCssClass($options, 'active');
        }
        $linkHtml = $this->renderItemLink($item);
        $arrowHtml = Html::tag('b', '', ['class' => 'arrow']);
        return Html::tag('li', $linkHtml . $arrowHtml, $options);


    }
1132882
public function transform($item)
    {
        if (null === $item) {
            return '';
        }

        $getter = 'get'.ucfirst($this->primaryKey);
        if ($this->multiple && (is_array($item) || $item instanceof \Traversable)) {
            $result = [];

            foreach ($item as $it) {
                if (method_exists($it, $getter)) {
                    $result[] = $it->$getter();
                } elseif (method_exists($it, 'getId')) {
                    $result[] = $it->getId();
                }
            }

            return implode($this->glue, $result);
        }

        if (method_exists($item, $getter)) {
            return $item->$getter();
        }
        if (method_exists($item, 'getId')) {
            return $item->getId();
        }

        return '';
    }