buildPostlink method

@param MenuItemPostlink $item menu item entity
@param string $postFix additional label elements
@param string[] $params HTML attributes
@return string generated HTML element
346126
protected function buildPostlink(MenuItemPostlink $item, string $postFix = '', array $params = []): string
    {
        $params['title'] = $item->getLabel();
        $params['escape'] = false;

        if (!empty($item->getConfirmMsg())) {
            $params['confirm'] = $item->getConfirmMsg();
        }

        $label = '<i class="fa fa-' . $item->getIcon() . '"></i> ' . ($this->noLabel ? '' : __($item->getLabel())) . $postFix;
        $result = $this->viewEntity->Form->postLink($label, $item->getUrl(), $params);

        return $result;
    }
4166
public function callbackItemClick(ManialinkInterface $manialink, $login, $params, $args)
    {
        $this->menuContentFactory->create($login);

        /** @var ItemInterface $item */
        $item = $args['item'];
        $item->execute($this->menuContentFactory, $manialink, $login, $params, $args);
    }
259214
public function append(string $postfix): Utility
    {
        return new static($this->string . new static($postfix, $this->encoding), $this->encoding);
    }
1157795
public function getLinkToAction($actionName, $params, $pk_link = false)
    {
        $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);

        $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';

        $params['icon'] = (isset($params['icon']) ? $params['icon'] : 'icon-th-list');
        $params['params']['class'] = (isset($params['params']['class']) ? $params['params']['class'] : 'btn');
        $params['only_icon'] = (isset($params['only_icon']) ? $params['only_icon'] : true);
        $params['size'] = $this->defaultSize($params);
        $params['params']['class'] .= ' ' . $params['size'];
        $title = '__(\'' . $params['label'] . '\', array(), \'' . $this->getI18nCatalogue() . '\')';
        $label = (!$params['only_icon'] ? ' \'.' . $title : '\'');

        return '[?php echo link_to(\'<i class="' . $params['icon'] . '"></i>'
        . $label . ', \'' . $this->getModuleName() . '/' . $action
        . $url_params . ', ' . $this->asPhp($params['params']) . ') ?]';
    }
76398
protected static function menuLinkPanel()
    {
        // List one menu panel for each post type
        $panels =[];
        foreach(PostType::all() as $postType){
            $panels[] = [
                'label' => $postType->name,
                'belongsTo' => $postType->slug,
                'controller' => ($postType->hasCustomController() ? $postType->getCustomController() : 'PostController'),
                'search' => [
                    'label' => trans('base.search'),
                    'placeholder' => trans('base.searchPlaceholder'),
                    'url' => route('backend.post.menuPanelItems', ['keyword' => "", "postTypeSlug" => $postType->slug])
                ],
                'items' => [
                    'label' => trans('base.latest'),
                    'url' => route('backend.post.menuPanelItems', ["postTypeSlug" => $postType->slug])
                ],
            ];
        }
        return $panels;
    }
1036148
public function addMenuItem(Request $request, array $item, MenuItem $menu)
    {
        $attributes = array();

        // if the menu item has a name, add it as a css class.
        if ($name = $item['name']) {
            $attributes['class'] = $name;
        }
        if (empty($item['path'])) {
            $uri = null;
        } elseif (preg_match('!^(?:https?://|mailto:)!', $item['path'])) {
            $uri = $item['path'];
        } else {
            $baseUrl = $request->getBaseUrl();
            $uri = $baseUrl . '/' . ltrim($item['path'], '/');
        }

        $menuItem = $menu->addChild(
            $item['id'],
            array(
                'uri' => $uri,
                'attributes' => $attributes,
                'label' => $item['title']
            )
        );

        if (!empty($item['json_data'])) {
            $item['json_data'] = @json_decode($item['json_data']);
        }

        $menuItem->setExtras($item);
        return $menuItem;
    }
740132
public function getChildMenuItems(MenuItem $item): string
    {
        $results = '';

        foreach ($item->getChilds() as $child) {
            if ($child->isHidden()) {
                continue;
            }

            if ($child->hasChilds()) {
                $results .= $this->getMultiLevelDropdownWrapper($child);
            } elseif ($child->isHeader()) {
                $results .= $this->getHeaderWrapper($child);
            } elseif ($child->isDivider()) {
                $results .= $this->getDividerWrapper();
            } else {
                $results .= $this->getMenuWithoutDropdownWrapper($child);
            }
        }

        return $results;
    }
626988
public function runAction($postfix = null)
    {
        $longId = $this->getId($postfix);
        $action = $this->switch->controller->hasInternalAction($longId) ? $longId : $this->id;

        return $this->switch->controller->runAction($action);
    }
488558
public function addResourceItem(ProductionMenuCollectionEvent $event): void
    {
        $menu = $event->getMenu();
        $group = $event->getGroup();

        // Create resource menu item.
        $resources = $this->factory->createItem('menu_item.resources', [
            'route' => 'bkstg_resource_index',
            'routeParameters' => ['production_slug' => $group->getSlug()],
            'extras' => [
                'icon' => 'file',
                'translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($resources);

        // If this user is an editor create the post and archive items.
        if ($this->auth->isGranted('GROUP_ROLE_EDITOR', $group)) {
            $resources_resources = $this->factory->createItem('menu_item.resources_resources', [
                'route' => 'bkstg_resource_index',
                'routeParameters' => ['production_slug' => $group->getSlug()],
                'extras' => ['translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN],
            ]);
            $resources->addChild($resources_resources);

            $archive = $this->factory->createItem('menu_item.resources_archive', [
                'route' => 'bkstg_resource_archive',
                'routeParameters' => ['production_slug' => $group->getSlug()],
                'extras' => ['translation_domain' => BkstgResourceBundle::TRANSLATION_DOMAIN],
            ]);
            $resources->addChild($archive);
        }
    }
1036535
public function addItem($item = null, $action = null)
    {
        if (is_string($item)) {
            $item = ['Item', $item];
        } elseif (is_array($item)) {
            array_unshift($item, 'Item');
        } elseif (!$item) {
            $item = ['Item'];
        }

        $item = $this->add($item)->setElement('a');

        if (is_string($action) || is_array($action)) {
            $action = $this->url($action);
        }

        if (is_string($action)) {
            $item->setAttr('href', $action);
        }

        if ($action instanceof jsExpressionable) {
            $item->js('click', $action);
        }

        return $item;
    }
1012510
public static function createSitemapItemFromPostValues($postValues)
    {
        if (isset($postValues['title'], $postValues['url'], $postValues['component'], $postValues['template'])) {
            $sitemapObject = new \stdClass();
            $sitemapObject->title = $postValues['title'];
            $sitemapObject->slug = StringUtil::slugify($postValues['title']);
            $sitemapObject->url = $postValues['url'];
            $sitemapObject->component = $postValues['component'];
            $sitemapObject->template = $postValues['template'];
            $sitemapObject->regex = isset($postValues['regex']);
            $sitemapObject->parameters = new \stdClass();
            if (isset($postValues['parameterNames'], $postValues['parameterValues'])) {
                foreach ($postValues['parameterNames'] as $key => $value) {
                    $sitemapObject->parameters->$value = $postValues['parameterValues'][$key];
                }
            }

            return $sitemapObject;
        } else {
            throw new \Exception('Trying to create sitemap item with invalid data.');
        }
    }
1234915
public function getPostSendMessage($item)
    {
        if (empty($this->postSendMessages[$item])) {
            return null;
        }
        return $this->postSendMessages[$item];
    }
483607
public function postLink($title, array $url, array $options = []) {
		if (!$this->hasAccess($url)) {
			return $this->_default($title, $options);
		}
		unset($options['default']);

		return $this->Form->postLink($title, $url, $options);
	}
1128595
protected function renderItem($item, $parent = null) {
        if (empty($item['items'])) {
            $linkTemplate = $this->linkTemplate;
            $labelTemplate = $this->labelTemplate;
            $url = isset($item['url']) ? Html::encode(Url::to($item['url'])) : "#";
        } else {
            $linkTemplate = $this->itemSubmenuLinkTemplate;
            $labelTemplate = $this->itemSubmenuLabelTemplate;
            $url = "#" . $item['id'];
        }
        $template = ArrayHelper::getValue($item, 'template', $linkTemplate);

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

        return strtr($template, $params);
    }
571935
private function getTemporaryFile($postfix) {
        $sysFileName = tempnam(sys_get_temp_dir(), 'daux');
        if ($sysFileName === false) {
            throw new \RuntimeException("Could not create temporary file");
        }

        $newFileName = $sysFileName . $postfix;
        if ($sysFileName == $newFileName) {
            return $sysFileName;
        }

        if (DIRECTORY_SEPARATOR == '\\' ? rename($sysFileName, $newFileName) : link($sysFileName, $newFileName)) {
            return $newFileName;
        }

        throw new \RuntimeException("Could not create temporary file");
    }
225116
public static function menuLink($item)
    {
        $app = \JFactory::getApplication();
        $menu = $app->getMenu();
        $item = $menu->getItem($item);

        return \JRoute::_($item->link . '&Itemid=' . $item->id);
    }
1234613
public final void append(AbstractItemLink link) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "append", link);

        if (link.isItemStreamLink())
        {
            _itemStreams.append(link);
        }
        else if (link.isReferenceStreamLink())
        {
            _referenceStreams.append(link);
        }
        else
        {
            _items().append(link);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "append");
    }