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.
I am fed up writing node_load(array('nid' => $nid))
all the time.
BTW. if this is accepted, next is node_view to accept a $nid.
Comment | File | Size | Author |
---|---|---|---|
#16 | nodeload_1.patch | 18.15 KB | chx |
#15 | nodeload_0.patch | 18.98 KB | chx |
#14 | nodeload.patch | 15.46 KB | chx |
#8 | node_load_4.patch | 15.31 KB | chx |
#7 | node_load_3.patch | 18.95 KB | chx |
Comments
Comment #1
chx CreditAttribution: chx commentedComment #2
adrian CreditAttribution: adrian commentedI am going to +1 this.
node_load(x) is much more natural to type. Having it use an array if found is useful too though.
Comment #3
chx CreditAttribution: chx commentedDries, if I remember correctly, you favoured this approach.
Comment #4
chx CreditAttribution: chx commentedPHPdoc.
Comment #5
Jose Reyero CreditAttribution: Jose Reyero commented+1
It's not only about lazy developers -which I am ;-)- it's also about shorter code => less errors, easier to catch
Comment #6
chx CreditAttribution: chx commentedThe patch and its consequences makes me love the version at http://drupal.org/node/25634#comment-33584 more, but Dries will be the one to decide.
Comment #7
chx CreditAttribution: chx commentedA few things slipped in from another patch which should not be here.
Comment #8
chx CreditAttribution: chx commentedSame problem as above.
Comment #9
ezheidtmann CreditAttribution: ezheidtmann commentedI like this! Is there a similar issue for user_load()?
Comment #10
Steven CreditAttribution: Steven commentedI definitely prefer the version where we simply allow $conditions to be passed as an integer, rather than introducing additional parameters.
It matches PHP's convention of having "mixed" argument types for some functions for shorthands (e.g. str_replace allows array arguments to compact multiple replacements in one statement). And not unimportant: it does not break backwards compatibility for what it essentially syntactic sugar.
Comment #11
chx CreditAttribution: chx commentedSteven. Dries did not like that version hence the additional parameter.
Dries, now that even Steven is on my side, would you please reconsider :) ?
Comment #12
adrian CreditAttribution: adrian commentedI concurr about the mixed parameter.
Comment #13
walkah CreditAttribution: walkah commentedlet me weigh in +1 on the mixed parameter side ... let's get away from blowing up backwards compatibility unless it's justified and/or unavoidable for the sake of progress. please :)
Comment #14
chx CreditAttribution: chx commentedComment #15
chx CreditAttribution: chx commentedpoor book module remained unpatched.
Comment #16
chx CreditAttribution: chx commentedwrong version.
Comment #17
Stefan Nagtegaal CreditAttribution: Stefan Nagtegaal commentedI thought this had hit the trunk some days ago.. Chx, can you or Dries confirm and mark this issue as "Fixed"?
Comment #18
Dries CreditAttribution: Dries commentedThis has been committed. Marking it 'fixed'.
Comment #19
(not verified) CreditAttribution: commentedComment #20
(not verified) CreditAttribution: commentedComment #21
ax CreditAttribution: ax commentedComment #22
(not verified) CreditAttribution: commentedComment #23
(not verified) CreditAttribution: commentedComment #24
(not verified) CreditAttribution: commented