Add "Add" item to toolbar.

Created on 18 November 2014, over 9 years ago
Updated 16 June 2023, about 1 year ago

Problem/Motivation

Adding content is a critical function in Drupal. While we have added a tools block and a default shortcut for this EVERY OTHER MAJOR CMS puts an add or create content link in the MAIN toolbar. This is marked critical because it is a critical usability problem in Drupal that a new user has to hunt around just to find where to do the most fundamental thing that a CMS does; create content.

Content can not only be nodes, but also media items or custom entities

Proposed resolution

(a) The optimal solution would be to make "Add content" a primary toolbar item using hook_toolbar() with a tray for the available types.

(b) Alternatively, we can add another menu that is linked to "Add" and displayed in the tray. Node, Media and other modules can then add menu items to it, and sitebuilders can customize it per site.

Remaining tasks

Write new patch.

For (b)

  • .
  • In case the Media module provides default media types: add them as well.
  • Fix the tests.

User interface changes

The item 'add content' would appear in the top toolbar.

This is a UI change and therefore the hook_help text and other documentation needs to be changed.

API changes

?

Data model changes

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
ToolbarΒ  β†’

Last updated about 2 hours ago

  • Maintained by
  • πŸ‡«πŸ‡·France @nod_
Created by

πŸ‡ΊπŸ‡ΈUnited States breathingrock

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI
  • last update about 1 year ago
    Custom Commands Failed
  • @bnjmnm opened merge request.
  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

    The MR is better categorized "needs architectural review" - it should get some eyes on it to help shape it into a good addition to core. This is the UX meeting approved approach from #84, but there are still choices to be made within that approach. I'm sure there are ways to make it more appealing, but it's doing what it is supposed to do and at a good spot to pick up the baton.

  • πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

    I'm really conflicted about this :)

    I feel like I've shut this down on the last iteration and I feel bad about that. I actually like the idea of having this kind of overview, but at the same time, I also feel quite strongly that we have to get this right and and it needs to be the right kind of extensible and live in a sensible place.

    Having node branch out to other entity types and the tricks with the node list preprocess and $type suddenly no longer being a node type entity is strange, but I guess the current MR is in a proof of concept phase. Like the links all pointing to node/add/$bundle ;)

    For fun, I tried to add it on our project which has a lot of extra contrib modules, just to see what happens. Interestingly, it dies already on shortcut if you have assertions enabled:

    AssertionError: Cannot load the "shortcut_set" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

    You can't call createAccess() with bundle NULL on an entity type with bundle, that doesn't actually equal a check to see if you can create an entity of any bundle. I think that extra check can be dropped, instead we need to check at the end if we ended up with any accessible bundle for a given type, a bit like \Drupal\Core\Entity\EntityCreateAnyAccessCheck.

    When I do disable that bit, then I end up with the ability to create things like a Shortcuts, Crop, Paragraphs and Webform submissions. I think that shows nicely that this really needs to be an opt-in process. When adding entity reference fields, we have the concept of "common_reference_target = TRUE" on the entity type annotation. We could add a content_add_overview = TRUE annotation to entity types and add it to terms, media and custom blocks as a start.

    In regards to bundles, instead of limiting it to entity types with bundles and bundles as config entities, this should use \Drupal\Core\Entity\EntityTypeBundleInfo::getBundleInfo() and while not common in core/contrib, we should maybe find a way to support entity types without bundles too. We don't have too much many of those in core, menu links is one example, but that's tricky to add here anyway. We don't have a standardized way for bundle descriptions nor add links I suppose.

    As an alternative to that declarative approach, we could just consider a hook and let other modules add their own sections here "by hand", might not even need to be content entities, could be anything sites consider to be things their editors typically add.

  • last update about 1 year ago
    29,379 pass, 2 fail
  • last update about 1 year ago
    29,379 pass, 2 fail
  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    I really like the concept screenshot in #94, I'm not sure how I feel though about the "Other entity types" but I think that's on a really good track. One of the challenges of this issue is fitting everything into the toolbar, but if the "Add" toolbar link simply takes you to this page then I think that's a really good path forward!

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Tried testing but didn't get too far

    Clicking the "Add content" link throws a fatal error

    AssertionError: Cannot load the "shortcut_set" entity with NULL ID. in assert() (line 261 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).

    cleared cache multiple times but no luck.

    But to echo #96 like the idea of going to a single page. Think it's a very clean approach and addresses the goal.

    Thought about cleaning some of the tags but didn't know what was needed for this initiative.

  • πŸ‡³πŸ‡±Netherlands yoroy

    What I think I'm reading here:

    - A single url/page as the location for presenting "things you might want to create" would provide a good "UI-infra" basis to build from.
    - On which items to get there and how to get them there: [2377543-96], I like the thinking in the last paragraph:

    we could just consider a hook and let other modules add their own sections here "by hand", might not even need to be content entities, could be anything sites consider to be things their editors typically add.

    . This sounds like a nice approach that leaves things open for contrib to experiment with, which would be a plus I think. Leaving it to the architectural experts to come up with the right technical implementation for this :)
    - The mockup in [2377543-94] would already be a good ux improvement as is. I'm thinking about additional features to star/promote items so that they show up as a select list under the "add" in the toolbar etc. But we would still want to introduce this basic page first. Lets focus on that.

  • πŸ‡ΊπŸ‡ΈUnited States tim.plunkett Philadelphia

    Removing tag for now

Production build 0.69.0 2024