getSnippetNamespaceFrontend example


    private $snippetManager;

    public function __construct(SnippetManager $snippetManager)
    {
        $this->snippetManager = $snippetManager;
    }

    public function translate(Type $type): Type
    {
        $namespace = $this->snippetManager->getNamespace($type->getSnippetNamespaceFrontend());

        $type->setName($namespace->get('name', $type->getName()));

        foreach ($type->getFields() as $field) {
            $field->setLabel($namespace->get(strtolower($field->getName()) . '_label', $field->getLabel()));
        }

        return $type;
    }
}
Home | Imprint | This part of the site doesn't use cookies.