esit/scopehelper

这是一个为开源CMS Contao的扩展

安装: 4

依赖: 0

建议者: 0

安全性: 0

星星: 0

关注者: 1

分支: 0

开放问题: 0

类型:contao-bundle

1.0.3 2024-09-16 12:45 UTC

This package is auto-updated.

Last update: 2024-09-16 12:52:28 UTC


README

描述

此软件是开源CMS Contao的扩展,提供了一种区分前端和后端的方法。

作者

e@sy Solutions IT: Patrick Froch info@easySolutionsIT.de

要求

  • php: ^8.2
  • contao/core-bundle:^4.13

安装

可以从仓库中拖动发布版本的文件到Contao Manager中。

配置

此扩展无需配置。

使用

例如,ScopeHelper可以用在内容元素中,以区分前端和后端。

<?php

declare(strict_types=1);

namespace Esit\Imageport\Classes\Contao\Elements;

use Contao\ContentElement;
use Contao\System;
use Esit\Scopehelper\Classes\Services\Helper\ScopeHelper;

class ContentTestElement extends ContentElement
{
    // ...

    protected function compile(): void
    {
        $scopeHelper = System::getContainer()->get(ScopeHelper::class);

        if (true === $scopeHelper?->isBackend()) {
            // Ausgabe für das Backend
        } else {
            // Ausgabe für das Frontend
        }
    }
}