FriendsOfCake / bootstrap-ui

CakePHP: Transparently use Bootstrap
MIT License
340 stars 146 forks source link

5.x: undefined index notices #392

Closed dereuromark closed 1 year ago

dereuromark commented 1 year ago

This is a (multiple allowed):

5.x and latest bootstrap-ui plugin code (5.0.0)

What you did

Adding helper normally in AppView

$this->addHelper('BootstrapUI.Form');

Expected Behavior

Normally working

Actual Behavior

[Warning (2) ](javascript:void(0);): Undefined array key "formGroupPosition" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 951]
[Warning (2) ](javascript:void(0);): Undefined array key "feedbackStyle" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 952]
[Warning (2) ](javascript:void(0);): Undefined array key "type" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 989]
[Warning (2) ](javascript:void(0);): Undefined array key "error" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1000]
[Warning (2) ](javascript:void(0);): Undefined array key "required" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1017]
[Warning (2) ](javascript:void(0);): Undefined array key "help" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1033]
[Warning (2) ](javascript:void(0);): Undefined array key "help" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1096]
[Warning (2) ](javascript:void(0);): Undefined array key "tooltip" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1140]
[Warning (2) ](javascript:void(0);): Undefined array key "help" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1334]
[Warning (2) ](javascript:void(0);): Undefined array key "help" [in /shared/httpd/sandbox/vendor/friendsofcake/bootstrap-ui/src/View/Helper/FormHelper.php, line 1354]

in every form

ADmad commented 1 year ago

Your stack trace has 1st error at 951 which is a blank line for 5.0.0 release https://github.com/FriendsOfCake/bootstrap-ui/blob/5.0.0/src/View/Helper/FormHelper.php#L951. So I don't think you have the latest release installed.

dereuromark commented 1 year ago

5.0.0 as latest There were no more commits

dereuromark commented 1 year ago

I know what it is...

$options = $this->_spacingOptions($fieldName, $options);
// NOW it gets nuked:
$options = $this->_containerOptions($fieldName, $options);
$options = $this->_feedbackStyleOptions($fieldName, $options);

in _containerOptions():

        if (
            $this->_align !== static::ALIGN_INLINE &&
            isset($options['type']) &&
            $options['spacing'] !== false
        ) {
            $classes = $options['spacing'] ?? [];
            $options = (array)($options['container'] ?? []);
            $options['container'] = $this->injectClasses($classes, $options);
        }

You can see that in this case $options gets set to only container, which only contains templates, nothing else Thus all the warnings now.

dereuromark commented 1 year ago

But it did get fixed on master in the meantime, so closing.