Two lines of code that are immensely useful.

CommentFileSizeAuthor
#6 patch_1861.16 KBmoshe weitzman
patch_1771.11 KBmoshe weitzman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

KarenS’s picture

Definitely a +1 on this idea, I have had many times I wished I could do this.

The only issue I can think of is that a malfunctioning module can corrupt the whole array, but I guess a malfunctioning module can do lots of damage in lots of other ways, too, and you can get it back by uninstalling the module and refreshing the cache, so there are worse problems to have.

merlinofchaos’s picture

Status: Needs review » Fixed

I have serious reservations about this patch, because any time two modules try to use this and clash, or one module misuses this and messes up things in a completely different location, that's going to come back to me and cost me a lot of time figuring out what is wrong, and I already spend enough time figuring out what is wrong with peoples' Views.

That said I'm too tired to just say no, and I do see the utility. Therefore, this is going to be added as a feature, and may well remain permanently undocumented to try and avoid people actually using it.

merlinofchaos’s picture

Status: Fixed » Needs work

I had to revert this patch. It is broken: http://drupal.org/node/110658

beginner’s picture

FYI, the patch caused this, too: http://drupal.org/node/110502 .

beginner’s picture

Should this patch be revived, please have a look at the issue I just posted: it is important to regularly clear the cache when developing, to see the real effect the code is having. I hope this information will prevent similar problems in the future.

moshe weitzman’s picture

Status: Needs work » Needs review
FileSize
1.16 KB

i apologize to all for breaking Views with that last patch. here is another one, properly tested, by clearing cache and exercising the new hooks.

merlinofchaos’s picture

Would it be better to just send the item as a reference? It means we can't use module_invoke_all but it's a small loop, and a reference seems a lot better than tossing around copies of the fairly large views data structure.

chx’s picture

alter typically is a reference indeed.

merlinofchaos’s picture

Status: Needs review » Fixed

Modified version that uses reference rather than return value applied.

Anonymous’s picture

Status: Fixed » Closed (fixed)