Posted by xjm

This issue is a followup for #1781372: Add an API for listing (configuration) entities and #1783964: Allow entity types to provide menu items.

Problem/Motivation

Proposed resolution

Remaining tasks

User interface changes

Current behavior

list-controller-no-add-link.jpg

Intended behavior

list-controller-add-link.jpg

Files: 
CommentFileSizeAuthor
#19 drupal-new-entity-link-1798540-19.patch7.42 KBjamesquinton
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,740 pass(es).
[ View ]
#17 drupal-new-entity-link-1798540-17.patch7.58 KBjamesquinton
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,822 pass(es).
[ View ]
#14 drupal-new-entity-link-1798540-13.patch3.07 KBjamesquinton
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,919 pass(es).
[ View ]
#14 drupal-new-entity-link-1798540-13.patch3.07 KBjamesquinton
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]
#13 drupal-new-entity-link-1798540-13.patch5.09 MBjamesquinton
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]
#4 drupal-1798540-4.patch3.39 KBdawehner
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-1798540-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Issue tags:+Usability

Issue tags:+Entity system, +VDC, +Configurables

Title:Add link to add a new entity inside the entity list controller table when no items are listedAdd link to add a new entity in an empty entity list controller table

Issue summary:View changes

Updated issue summary.

Status:Active» Needs review
Issue tags:+Needs tests
StatusFileSize
new3.39 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-1798540-4.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

I'm wondering whether this should be part of the interface, so i started without it.

It feels ugly to remove all existing config entities in the test to be able to check this
functionality.

Hrm. We really need an entity operations/actions API. That has become crystal clear through a dozen of issues already.

I rather object to working around that missing puzzle piece even further. Let's fix the root cause/limitation instead.

An entity operations/actions API would inherently depend on #1696660: Add an entity access API for single entity access, since that introduces generic access handling, so each operation/action can be properly checked for access before it is exposed.

Closely related #1839516: Introduce entity operation providers

The "Add item/sub-item" could be a operations

Issue tags:+Blocks-Layouts

The proposed change here attempts to hardcode a 1:1 relationship between an entity and where it appears in a listing, or perhaps rather, where its "Add form" is located.

However, architecturally, that's really not where we want to go. In case you know http://drupal.org/project/context_admin, that's much more in line with our architectural goals — entities can be listed in various contexts, and within each context, you are able to add a new, but also manage existing.

In a bit more abstract RESTful speak, this means:

List: GET /entity
List: GET /admin/content/entity
Add:  POST /entity
Add:  POST /admin/content/entity
Edit: POST /entity/{id}
Edit: POST /admin/content/entity/{id}
...

Unfortunately, the pure RESTful pattern cannot be applied to web-based form interaction. A typical way to work around it would be to replace the {id} with a static placeholder string that would be invalid as a regular/true ID otherwise; e.g.:

Add:  GET|POST /entity/:new:
Add:  GET|POST /admin/content/entity/:new:

In turn, regardless of the current context, you're able to retrieve the URI for creating/adding a new entity based on its regular URI pattern:

$entity = entity_create('foo', array(
  'id' => ':new:',
);
$uri = $entity->uri();

I'm aware that we didn't make much progress on contexts yet, but the proposed change here with a hard 1:1 binding would implicitly move us into a direction that is not aware of contexts, whereas we want to go into the opposite direction and make this stuff context-aware.

Tagging with Blocks/Layouts, in the hope that @EclipseGc and others might be able to chime in.

Status:Needs review» Needs work
Issue tags:+Usability, +Needs tests, +Entity system, +VDC, +Blocks-Layouts, +Configurables

The last submitted patch, drupal-1798540-4.patch, failed testing.

+++ b/core/lib/Drupal/Core/Entity/EntityListController.phpundefined
@@ -64,6 +64,23 @@ public function load() {
+    if (isset($this->entityInfo['uri_prefix']) && isset($this->entityInfo['label'])) {

I think all entities should have uri() method implemented or use parent

Well, but how can we use uri() to create a link to a creation for of entities? I don't see how this can workout.

Issue summary:View changes

Typo.

Yeah, uri() won't really help us as we don't have an entity. Also I thought #1970360: Entities should define URI templates and standard links may have helped us here, but it seems that the summary mentions create urls but it didn't make it into the patch?

Issue summary:View changes

Removing myself from the author field so I can unfollow. --xjm

Assigned:Unassigned» jamesquinton
Issue summary:View changes
Status:Needs work» Needs review
StatusFileSize
new5.09 MB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]

Re-rolled patch and updated.

StatusFileSize
new3.07 KB
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] Setup environment: Test cancelled by admin prior to completion.
[ View ]
new3.07 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,919 pass(es).
[ View ]

Woops..! Here's the correct patch.

The last submitted patch, 13: drupal-new-entity-link-1798540-13.patch, failed testing.

The last submitted patch, 14: drupal-new-entity-link-1798540-13.patch, failed testing.

StatusFileSize
new7.58 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,822 pass(es).
[ View ]

Updated and added link to the following lists:

  • Date formats
  • Custom block types
  • Custom blocks
  • Node
  • Image styles
  • Responsive image mappings

I don't think every entity list needs this, for example User Roles - where you can’t remove the default roles, and therefore never have an empty list.

“entity-add-form” link key could probably be named better.

Status:Needs review» Needs work
Issue tags:+Needs reroll

Doh - rerolling without my .gitignore in the patch...

Status:Needs work» Needs review
Issue tags:-Needs reroll
StatusFileSize
new7.42 KB
PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 67,740 pass(es).
[ View ]

Rerolled