moacode / craft-fab-permissions

Restrict access to fields and tabs for particular user groups across your Craft elements.
Other
16 stars 9 forks source link

Craft 3.2.0 RC3 : Fatal Error in CP : abstract methods not declared or implemented #3

Closed ajoliveau closed 4 years ago

ajoliveau commented 5 years ago

Hello, After installing the plugin and adding some protected fields on an entry type, when logging in as a user in one of the restricted groups, I have the following error on some of the Control Panel pages :

PHP Fatal Error – yii\base\ErrorException Class thejoshsmith\fabpermissions\decorators\StaticFieldDecorator contains 2 abstract methods and must therefore be declared abstract or implement the remaining methods (craft\base\FieldInterface::valueType, craft\base\FieldInterface::afterElementPropagate)

If I manually add basic implementations for the two methods, it works :

public function afterElementPropagate(ElementInterface $element, bool $isNew) {
    return;
}
public static function valueType() : string {
    return "test";
}

It affects the dashboard page (/admin/dashboard) and the Entry creation/modification page where the field with the permissions is located.

I'm running :

It looks like these new methods have been added in Craft 3.2, as we can see in the history of the FieldInterface file : https://github.com/craftcms/cms/commits/3.2/src/base/FieldInterface.php

Thank you for this plugin !

moacode commented 4 years ago

Apologies—for some reason I didn't get a notification about this issue and just saw it. I'll have a look at your pull request shortly!

moacode commented 4 years ago

Cheers for finding and fixing this issue! I've tweaked your pull request slightly, but you did all the hard work in tracking it down 😄