This is a patch to add classes to the 'Create Content' node add list.
This would allow the adding of icons to the node add list which would increase usability of that form.
This is a two line addition to the theme_node_add_list function.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | drupal8.node-theme-add-list.12.patch | 3.07 KB | sun |
| #11 | 439350-11.patch | 1.54 KB | jody lynn |
| #6 | theme_node_add_list_3.patch | 908 bytes | acouch |
| #4 | theme_node_add_list_2.patch | 907 bytes | acouch |
| theme_node_add_list.patch | 994 bytes | acouch |
Comments
Comment #1
acouch commentedComment #2
acouch commentedSetting this to 'needs review'.
Comment #3
jody lynnUsing the 'access_arguments' seems a little odd, although I can see you are limited in what the menu system gives you. I think it will be better to use the 'href' and pull the node/add/ off the front of it.
Also change node-add-list to node-type-list for consistency.
Comment #4
acouch commentedThanks for the feedback. I implemented your suggestions. The patch is resubmitted.
Comment #5
jody lynn$class = str_replace("node/add/","",($item['href']));should be
$class = str_replace('node/add/', '', $item['href']);(spacing after commas, removal of extraneous parentheses, use of simpler single quotes)
<dt class="node-type-list-'. $class . '">needs a space before the . (this spacing standard was changed for D7)Comment #6
acouch commentedThanks for the feedback. I implemented your suggestions. The patch is resubmitted.
Comment #7
jody lynnLooks good to me. Adding in the classes themers need is a good thing.
Comment #8
jpoesen commentedWorks as advertised, but I wonder why we don't use theme_item() and them_item_list() for a more consistent display of lists of items throughout the admin interface.
Comment #9
acouch commentedhey jpoesen,
good point. i looked into it and theme_item_list() is currently broken but being updated: http://drupal.org/node/256827 . i think it would be good to try and make sure that classes more than just 'first' and 'last' are able to be added and are added for default elements.
i'm also looking at some other theme functions like theme_admin_block_content which themes the admin page but doesn't give classes so elements can have icons added.
Comment #10
webchickA couple things with this line:
1. There should be spaces after those commas.
2. I don't understand why $item['href'] is in parentheses. Looks like they can be removed.
3. It might be nice to have a comment here so themers understand what those classes are intended for? This might also be unnecessary. I am not a themer, so I defer to experts. :)
Also, should we leave the old "node-type-list" in addition to also adding this new class? It seems like you wouldn't be able to apply a style to all of the titles without duplicating an awful lot of rules?
Comment #11
jody lynnNew patch for D8.
I don't think code comments in here will help themers, as they will see the classes in the resulting markup.
Comment #12
sunI don't see why the class should be on the link only. It should be on the outer container.
Even more importantly, what is all that raw PHP in that theme function?
Attaching a prototype.
Comment #15
yesct commentedcorrecting the tag to the more common one.
Comment #29
acbramley commentedNo activity in >10 years, closing as outdated. Feel free to reopen if there's still something to fix.
This is also possible via a preprocess hook since node_add_list is a proper theme function now.