Problem/Motivation

reply_init() contains logic to limit access to field and display pages of locked bundles.
This logic belongs in a hook_menu_alter() that runs after field_ui has added its entries to the router.

Proposed resolution

Move the logic

Remaining tasks

Move the logic
Test coverage

User interface changes

None

API changes

reply_init() is gone, new access callback.

CommentFileSizeAuthor
#4 reply-reply_init-2362607-4.patch1.07 KBidebr

Comments

larowlan’s picture

idebr’s picture

What exactly is the use of 'locking' a reply bundle?

larowlan’s picture

Looks to be related to features integration, but seems to be borrowed from the node-type logic - which also has the concept of locked.
Either way I think that using hook_init() is the wrong approach

idebr’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB

I dated this hook back to 2012-02-05. The original commit message 'lalala' is not very helpful either: http://cgit.drupalcode.org/reply/commit/reply.module?id=db507297cc869225...

I would argue this hook is counterproductive. In a development environment where a reply bundle would be added through code for example using the Features module (reply_bundle.locked = 1), administrators would be unable to edit the reply bundle unless they have the original database in which the reply bundle was added. Considering this module is officially still in alpha, is removing the reply_init() a valid option in your opinion?

Attached a proposed patch

larowlan’s picture

I agree lalalala isn't much help :(
What happens if you save/edit a locked bundle with this patch? Does it blow up in your face?
I wonder why the bundles weren't made ctools exportables.

idebr’s picture

When a user saves/edits a locked bundle, the reply_bundle.status is updated to the 'Overridden' status and the bundle is saved to the database.

In the default behavior for locked bundles, for example Node types, the only thing that is different when a bundle is locked is there is no more 'delete' link available in the bundle admin ui.