dkischenkodkischenko MemberComments: 0 Received thanks: 0 Member since: September 2018

Greeting everyone !

I have a problem - snippets not works.

In Theme.php I use next

/**
     * @param Form\Container\TabContainer $container
     */
    public function createConfig(Form\Container\TabContainer $container)
    {
        $container->addTab($this->createBasicTab());
    }

    /**
     * Create Basic Tab
     * @return Form\Container\Tab
     */
    public function createBasicTab()
    {
        $tab = $this->createTab(
            'basic_settings',
            '__basic_settings__',
            [
                'attributes' => [
                    'layout' => 'anchor',
                    'autoScroll' => true,
                    'padding' => '0',
                ],
            ]
        );

In snippet located in _private/snippets/backend/config.ini I used next

[en_GB]

basic_settings = 'Basic settings'

[de_DE]

basic_settings = 'Basic settings de'

And in admin part I got next

https://i.imgur.com/5nOu8b6.png

 

Please, help!(

Comments

  • thecodebunnythecodebunny MemberComments: 11 Received thanks: 0 Member since: August 2018

    Hello,

    This might be late for you, but might help someone in need. In Theme.php

        private function BasicTab() {
            $basicTab = $this->createTab(
                'basic_tab',
                $this->getLabelAttribute()->get('basic_tab_label'),
                [
                    'attributes' => [
                        'autoScroll' => true
                    ]
                ]
            );
            $basicFieldset = $this->createFieldSet(
                'basic_fieldset',
                $this->getLabelAttribute()->get('basic_fieldset_label'),
                [
                    'attributes' => [
                        'layout' => 'column',
                        'flex' => 0,
                        'defaults' => [
                            'columnWidth' => 1,
                            'labelWidth' => 180,
                            'margin' => '2 15 2 0', 
                            'anchor' => '100%'
                        ]
                    ]
                ]
            );
            $basicFieldset->addElement(
                $this->createCheckboxField(
                    'basic_checkbox',
                    $this->getLabelAttribute()->get('basic_checkbox_label'),
                    true,
                    ['attributes' => ['lessCompatible' => false]]
                )
            );
            $basicTab->addElement($basicFieldset);
            return $basicTab;
        }
    
        private function getLabelAttribute()
        {
           return Shopware()->Snippets()->getNamespace('themes/MyThemeName/backend/config');
        }

     

Sign In or Register to comment.