[development] the time of $op is over?

Fabian Sörqvist fabian.sorqvist at gmail.com
Sat May 10 11:32:06 UTC 2008

As a new and unexperienced developer of drupal modules I must say I am
all for this suggestion. These $op-variables is quite a pain to keep
track off. I also think that much of my (and others) code will be much
cleaner and easier to read and understand if there where hooks instead
of an $op variable (which in many cases creates a huge switch
statement, which is not pretty).

On Sat, May 10, 2008 at 1:08 AM, James Walker <walkah at walkah.net> wrote:
> Having just finished a workshop where we have to explain this to new drupal
> developers, I'd like to echo David's sentiment - having $op - specific
> parameters is *very* confusing.
> On 9-May-08, at 10:50 AM, David Timothy Strauss wrote:
>> Please get rid of $op at least in the cases where the arguments change. I
>> want to see an end to $arg1, etc.
>> ----- "Gábor Hojtsy" <gabor at hojtsy.hu> wrote:
>>> Hello,
>>> Now that the registry patch landed, it looks like the time of $op
>>> might be over. General hooks implementing different branches with $op
>>> will always be loaded regardless of the exact need for them. Larry
>>> already suggests using the more granular *_preprocess_hookname() type
>>> of callbacks instead of the generic *_preprocess() callbacks for
>>> theme
>>> stuff, so that only those needed will be loaded. Take nodeapi for
>>> example. Code for loading nodes might often be needed, but not code
>>> for updating or deleting them, right? Those could easily be admin.inc
>>> stuff.
>>> So what do you think about $op? Should we evaluate on a case-by-case
>>> basis to make function level callbacks out of $op's or just do it
>>> wholesale (no, I am not volunteering for a patch) to get an overall
>>> consistent API.
>>> Gabor

More information about the development mailing list