Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block cfgs only possible in combination with vars #121

Closed
JohnnyMcWeed opened this issue Jul 13, 2018 · 0 comments
Closed

Block cfgs only possible in combination with vars #121

JohnnyMcWeed opened this issue Jul 13, 2018 · 0 comments
Assignees
Labels

Comments

@JohnnyMcWeed
Copy link
Contributor

JohnnyMcWeed commented Jul 13, 2018

What steps will reproduce the problem?

  • Create a new block
  • Add "cfgs"

What is the expected result?

  • A block with editable "cfgs"

What do you get instead? (A Screenshot can help us a lot!)

  • A block where "cfgs" cannot be edited

(If a single "vars" element is added, it seems to work)

Working Example:

<?php
/**
 * Alert Block.
 */
class AlertBlock extends PhpBlock
{
    ...
    /**
     * @inheritDoc
     */
    public function config()
    {
        return [
            'vars' => [
                [
                    'var' => 'test',
                    'label' => 'Test',
                    'type' => self::TYPE_TEXT
                ]
            ],
            'cfgs' => [
                 [
                     'var' => 'alertType',
                     'type' => self::TYPE_SELECT,
                     'label' => 'Alert Type',
                     'options' => BlockHelper::selectArrayOption([
                         'primary' => 'Primary',
                         'secondary' => 'Secondary',
                         'success' => 'Success',
                         'danger' => 'Danger',
                         'warning' => 'Warning',
                         'info' => 'Info',
                         'light' => 'Light',
                         'dark' => 'Dark',
                     ])
                 ],
                [
                    'var' => 'alertDismissable',
                    'type' => self::TYPE_CHECKBOX,
                    'label' => 'Dismissable Alert',
                ]
            ],
            'placeholders' => [
                 ['var' => 'alertContent', 'label' => 'Alert Content'],
            ],
        ];
    }
    ...
}

Not Working Example:

<?php
/**
 * Alert Block.
 */
class AlertBlock extends PhpBlock
{
    ...
    /**
     * @inheritDoc
     */
    public function config()
    {
        return [
            'cfgs' => [
                 [
                     'var' => 'alertType',
                     'type' => self::TYPE_SELECT,
                     'label' => 'Alert Type',
                     'options' => BlockHelper::selectArrayOption([
                         'primary' => 'Primary',
                         'secondary' => 'Secondary',
                         'success' => 'Success',
                         'danger' => 'Danger',
                         'warning' => 'Warning',
                         'info' => 'Info',
                         'light' => 'Light',
                         'dark' => 'Dark',
                     ])
                 ],
                [
                    'var' => 'alertDismissable',
                    'type' => self::TYPE_CHECKBOX,
                    'label' => 'Dismissable Alert',
                ]
            ],
            'placeholders' => [
                 ['var' => 'alertContent', 'label' => 'Alert Content'],
            ],
        ];
    }
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants