? Success

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
31 Oct 2016

To help resolve issue on PR #12505.

Summary of Changes

In order to add a new JModelAdmin functionality which work similar to plugin event onContentBeforeDelete and onContentAfterDelete but can not be disabled by administrator.

Developer will have an option to write additional required events without override whole JModelAdmin->delete method.

Testing Instructions

Code review.

Documentation Changes Required

JModelAdmin introduced a new methods that wrap plugin event call.

avatar csthomas csthomas - open - 31 Oct 2016
avatar csthomas csthomas - change - 31 Oct 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 31 Oct 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 31 Oct 2016
Category Libraries
avatar mbabker
mbabker - comment - 31 Oct 2016

You shouldn't need to do this, because in theory if someone overrides these methods and doesn't call the parent then the delete events aren't dispatched either.

You can though add callbacks to the event dispatcher without them being a plugin event through JEventDispatcher::getInstance()->register($eventName, $callable);. So all you'd really need is to load these callbacks into the dispatcher before the event is triggered (I can't say I have a "clean" solution for that honestly).

avatar csthomas
csthomas - comment - 1 Nov 2016

But you can write:

function triggerBeforeDelete(...)
{
    if (parent::triggerBeforeDelete($dispatcher, $context, $table) !== false)
    {
        // After plugin events success delete featured item before delete article row
    }
}

Delete Featured items should be call after 'onContentBeforeDelete' success.

Similar to JLanguageAssociations from https://github.com/joomla/joomla-cms/pull/12670/files#diff-39b4bc5cb02bbace2ee4febe8f54583eL777

Take a look at PR #12505. I thought that this idea can be a better way.

Also I thought about add some new method to JTable class but
adding method onBeforeDelete will duplicate JObserver functionality.

avatar mbabker
mbabker - comment - 1 Nov 2016

I get that, this just doesn't feel right for adding hooks to the system though. Because at this point it's actually not a hook, it's just an extended method call but instead of extending the entire delete method you're just extending the triggers for the event dispatcher, and doesn't feel any better than #12505 to me.

avatar csthomas
csthomas - comment - 1 Nov 2016

OK thanks, then I close this PR.

avatar csthomas csthomas - change - 1 Nov 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-11-01 00:26:47
Closed_By csthomas
avatar csthomas csthomas - close - 1 Nov 2016

Add a Comment

Login with GitHub to post a comment