定制 carbon/link 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

carbon/link

最新稳定版本:2.0.1

Composer 安装命令:

composer require carbon/link

包简介

Link helper for Neos CMS

README 文档

README

Latest Stable Version Total Downloads License GitHub forks GitHub stars GitHub watchers

Carbon.Link Package for Neos CMS

This package provides some fusion helper for link editor.

Installation

Most of the time you have to make small adjustments to a package (e.g. configuration in Settings.yaml). Because of that, it is important to add the corresponding package to the composer from your theme package. Mostly this is the site packages located under Packages/Sites/. To install it correctly go to your theme package (e.g.Packages/Sites/Foo.Bar) and run following command:

composer require carbon/link --no-update

The --no-update command prevent the automatic update of the dependencies. After the package was added to your theme composer.json, go back to the root of the Neos installation and run composer update. Et voilà! Your desired package is now installed correctly.

Questions

What is the node:// URI conversion requires a context node to be passed error about?

Carbon.Link:Link and the internal Neos.Neos:NodeUri make use of the commonly available documentNode context variable to obtain context information such as language and workspace and to calculate relative links. This variable is provided by default in the \Neos\Neos\View\FusionView, but not, for example, in the \Neos\Fusion\View\FusionView, which is mainly used for Model View Controller applications. Make sure that you manually retrieve the document node and add it to the view, e.g.

<?php

class ArticlesController extends ActionController
{
    ...

    public function listAction(): void
    {
        $workspaceName = 'live';
        $language = 'en';

        $contextProperties = [
            'workspaceName' => $workspaceName,
            'invisibleContentShown' => false,
            'inaccessibleContentShown' => false,
            'dimensions' => [
                'language' => [$language]
            ],
            'targetDimensions' => [
                'language' => $language
            ]
        ];

        $currentDomain = $this->domainRepository->findOneByActiveRequest();

        if ($currentDomain !== null) {
            $contextProperties['currentSite'] = $currentDomain->getSite();
            $contextProperties['currentDomain'] = $currentDomain;
        } else {
            $contextProperties['currentSite'] = $this->siteRepository->findFirstOnline();
        }

        $contentContext = $this->contextFactory->create($contextProperties);

        $site = $contentContext->getCurrentSiteNode();

        $this->view->assign('documentNode', $site);
    }
}

License

Licensed under MIT, see LICENSE

统计信息

  • 总下载量: 86.95k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-21