wbrowar / craft-grid

A field that lets you content manage CSS Grid in Craft CMS.
Other
18 stars 2 forks source link

Undefined index: prevMinWidth #1

Closed piotrpog closed 5 years ago

piotrpog commented 5 years ago

Just started testing out plugin, entered some random data to field setting and got error. Unfortunately im not really sure which thing caused this error specifically.

Undefined index: prevMinWidth

81828384858687888990919293949596979899                         * @inheritdoc
     */
    public function afterSave(bool $isNew)
    {
        if (!$isNew) {
            // Check for updated breakpoints
            $layout = Json::decodeIfJson($this->layout);
            $newMinWidths = [];
            foreach ($layout['breakpoints'] as $breakpoint) {
                if ($breakpoint['prevMinWidth'] !== $breakpoint['minWidth']) {
                    $newMinWidths[] = [
                        'old' => $breakpoint['prevMinWidth'],
                        'new' => $breakpoint['minWidth'],
                    ];
                }
            }
            // Update all elements that have field
            if (count($newMinWidths) > 0) {
                // Get layouts that include this field
wbrowar commented 5 years ago

Ah, okay. I know what's going on there. I'll fix that and get an update out today.

Thanks!

wbrowar commented 5 years ago

This is fixed in 465b24b