Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Two lines of code that are immensely useful.
Comment | File | Size | Author |
---|---|---|---|
#6 | patch_186 | 1.16 KB | moshe weitzman |
patch_177 | 1.11 KB | moshe weitzman |
Comments
Comment #1
KarenS CreditAttribution: KarenS commentedDefinitely 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.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedI 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.
Comment #3
merlinofchaos CreditAttribution: merlinofchaos commentedI had to revert this patch. It is broken: http://drupal.org/node/110658
Comment #4
beginner CreditAttribution: beginner commentedFYI, the patch caused this, too: http://drupal.org/node/110502 .
Comment #5
beginner CreditAttribution: beginner commentedShould 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.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedi apologize to all for breaking Views with that last patch. here is another one, properly tested, by clearing cache and exercising the new hooks.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedWould 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.
Comment #8
chx CreditAttribution: chx commentedalter typically is a reference indeed.
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedModified version that uses reference rather than return value applied.
Comment #10
(not verified) CreditAttribution: commented