Unable to install plugin due to validation callback

Tom Christian

Active member
I've built a plugin locally and now I want to install it on my online site.

However, I'm unable to import the plugin as a condition within my validation callback class is firing DURING the import? Is this standard behavior?

One of the conditions in my validation callback was to ensure a field was not blank so obviously it's returning false and therefore preventing the plugin from installing.

Any help is much appreciated.
 
Yep, just add this code to the top of the validation callback:

PHP:
if ($dw->isInsert())
{
    return true;
}

In this context the $dw is the Option DataWriter and it is currently inserting the new option and setting the default value. So isInsert() is only ever going to be true during add-on install, so in that context it is perfectly safe to escape out of the validation with the above code.
 
Yep, just add this code to the top of the validation callback:

PHP:
if ($dw->isInsert())
{
    return true;
}

In this context the $dw is the Option DataWriter and it is currently inserting the new option and setting the default value. So isInsert() is only ever going to be true during add-on install, so in that context it is perfectly safe to escape out of the validation with the above code.

Makes sense, thanks!
 
Top Bottom