schematic icon indicating copy to clipboard operation
schematic copied to clipboard

Default to empty array if settingsModel is broken

Open HelgeSverre opened this issue 5 years ago • 0 comments

If the settingsmodel is broken , default to an empty array.

This is workaround for the Ansel plugin which returns a Noop class instead of a proper settings model, which causes an ErrorException to be thrown.

image

From Ansel.php


    /**
     * We have to have this here because reasons (Craft has its faults)
     */
    public function createSettingsModel()
    {
        return new Noop();
    }

the Noop class causing an error exception if you try to export it's plugin settings.

<?php

namespace buzzingpixel\ansel;

class Noop
{
  
    public function __call(string $name, array $args)
    {
        return null;
    }
}

HelgeSverre avatar Jul 05 '18 12:07 HelgeSverre