When multiple sections of the same node type are created, only the first type is added to the command button list.

For Example:

I added 3 different discussion post sections. Only the first showed up under the 'node/add' command buttons. I will attach a patch that will allow multiple sections to be created of the same node type and add each of them to the 'node/add' command buttons for that section. In order for this to work across OA, I will be patching OA Buttons as well. I will link back when I get the patch up.

Comments

scottalan’s picture

scottalan’s picture

Haven't made a PR yet but this is basically what it will be. May need a little clean up. Will look it over better and make a PR later.

https://github.com/scottalan/oa_core/commit/de4649d38a3e46fbf287bea0fb53...

scottalan’s picture

Cleaned up the code and made a PR. https://github.com/phase2/oa_core/pull/56/files

scottalan’s picture

Changed the way the title is built so that it is built with the Section Type and the title of the Section.

The new title will be something like: Create Discussion Post in SECTION_TITLE

mpotter’s picture

Looking better. A couple of comments:

1) Sorry for the lack of documentation, but there is a helper function "oa_core_get_titles()" in the oa_core/includes/oa_core.util.inc file that you can use to grab the title. Since this will get cached in the future, it is better to use it. Otherwise you could also use node_load in this case since the parent and section nodes have already been loaded and cached to construct the OA toolbar.

2) Don't forget the t() around 'in'

scottalan’s picture

Ah, I was wondering if there was an api for titles. Should have searched a little harder. I will make the updates when I'm done with another fix I'm making and will post a new patch. Thanks for the feedback.

mpotter’s picture

Oh, and

3) Only add "in section name" if there is more than one choice.

mpotter’s picture

The pull request in oa_core has been merged! Thanks for the help on this!

scottalan’s picture

Two options:

Option 9.1: Handles both the space command buttons and the section command buttons. This may be overkill.

Option 9.2: Less code and, I think, makes more sense when you are in a space context viewing the command buttons.

I also looked at oa_core_get_titles(). Is that a little heavy since I just need the title and have access to one `id` at a time in the foreach? Let me know.

Thanks

  • Commit 41fdee2 on 7.x-1.x by mpotter:
    Issue #2273515 by scottalan: Added Multiple sections of the same node...
mpotter’s picture

Status: Active » Fixed

Your first patch was more what I was looking for. I also changed the db_query into a proper D7 db_select. Also removed a line that was filtering a query to only node_add command buttons, preventing custom command buttons from being used.

Committed to 41fdee2.

Needed to make some changes to oa_core also, but doing that as part of the 2.19 release, so stay tuned.

scottalan’s picture

Awesome! Thanks Mike.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.