[I originally included this change in the hook_flag_validate() patch. But it has merit on its own, and I want to protect it from a rollback, so I publish it here separately.]

This patch renames flag.tpl.php's $last_action to $status. Why?

- Why use inverse logic when we can use straight one? <... class=flag-$status ...> is easier to understand than <... class=flag-$last_action ...>

- $last_action conveys the impression that an action has been carried out; e.g., that it's only valid in $after_flagging; but it's not so, and furthermore, with the hook_flag_validate() feature an action may be canceled.

- Users use $last_action, although they don't have to, and create strange looking code.

CommentFileSizeAuthor
rename-last-action.diff2.6 KBmooffie

Comments

mooffie’s picture

- $last_action conveys the impression that an action has been carried out [...]
with the hook_flag_validate() feature an action may be canceled

That's my main problem with "$last_action". When hook_flag_validate() is in place the "$last_action" leaves a question in the reader's mind as to its *exact* meaning. By renaming it to "$status" we clear the doubt.

mooffie’s picture

(The change is backward compatible: at the bottom of template_preprocess_flag() there's a section that retains these deprecated variables.)

mooffie’s picture

Status: Active » Needs review
mooffie’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.