@see title.

It would be nice to have this as an optional feature... especially for exportable entities.

Patch incoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fubhy’s picture

Status: Active » Needs review
FileSize
4 KB

Maybe we need some entity property definitions for the description as well, currently this is only UI stuff in the patch.

Status: Needs review » Needs work

The last submitted patch, entity-description.patch, failed testing.

fubhy’s picture

Status: Needs work » Needs review
fago’s picture

Status: Needs review » Needs work
+++ b/entity.module
@@ -519,6 +519,24 @@ function entity_has_status($entity_type, $entity, $status) {
+ * Returns the description of a given entity if the entity type supports
+ * descriptions and a description is set.

First line of comments may not be wrapped, but may exceed 80chars.

+++ b/entity.module
@@ -519,6 +519,24 @@ function entity_has_status($entity_type, $entity, $status) {
+function entity_description($entity_type, $entity) {

I don't think we need a helper function for reading the description key. I don't think it's often used in code and in the admin-ui it's more performant to read out the value out of the there existing entity info anyway.

+++ b/entity.module
@@ -519,6 +519,24 @@ function entity_has_status($entity_type, $entity, $status) {
+  $description_key = empty($info['entity key']['description']) ? 'description' : $info['entity keys']['description'];

This should default to no description key.

+++ b/includes/entity.ui.inc
@@ -664,9 +666,14 @@ function entity_ui_validate_machine_name($element, &$form_state) {
+  // In order to display the description properly a float is required.
+  drupal_add_css(drupal_get_path('module', 'entity') . '/entity.admin.css');

The CSS got already added via #attached, not?

joachim’s picture

+++ b/includes/entity.ui.inc
@@ -664,9 +666,14 @@ function entity_ui_validate_machine_name($element, &$form_state) {
+  // In order to display the description properly a float is required.
+  drupal_add_css(drupal_get_path('module', 'entity') . '/entity.admin.css');

I don't think we need extra CSS here at all. Node module's content types list doesn't need any AFAICT.

joachim’s picture

Status: Needs work » Needs review
FileSize
2.6 KB

updated patch.

I've taken out the CSS. I can't see any difference with it there at all.

fubhy’s picture

The CSS is needed in case the overview is a tabledrag.

joachim’s picture

Ahhh.

But entity API's admin UI doesn't do tabledrags. (Yet -- I filed a feature request for that: #1659456: support for hierarchical entities.)
So currently, if an entity module turns this into a tabledrag it's surely up to that module to tweak the CSS as needed.

Chris Matthews’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs reroll

The 7 year old patch in #6 does not apply to the latest entity 7.x-1.x-dev.

Checking patch entity.api.php...
error: while searching for:
 *   - status: (optional) The name of the entity property used by the entity
 *     CRUD API to save the exportable entity status using defined bit flags.
 *     Defaults to 'status'. See entity_has_status().
 * - export: (optional) An array of information used for exporting. For ctools
 *   exportables compatibility any export-keys supported by ctools may be added
 *   to this array too.

error: patch failed: entity.api.php:74
error: entity.api.php: patch does not apply
Checking patch entity.module...
error: while searching for:
      'template' => 'entity',
    ),
    'entity_ui_overview_item' => array(
      'variables' => array('label' => NULL, 'entity_type' => NULL, 'url' => FALSE, 'name' => FALSE),
      'file' => 'includes/entity.ui.inc'
    ),
  );

error: patch failed: entity.module:857
error: entity.module: patch does not apply
Checking patch includes/entity.ui.inc...
Hunk #1 succeeded at 270 (offset 5 lines).
error: while searching for:
  if ($variables['name']) {
    $output .= ' <small> (' . t('Machine name') . ': ' . check_plain($variables['name']) . ')</small>';
  }
  return $output;
}

error: patch failed: includes/entity.ui.inc:668
error: includes/entity.ui.inc: patch does not apply
daiwik.addweb’s picture

Status: Needs work » Needs review
FileSize
2.66 KB

@Chris Matthews, Please review below-attached patch for latest entity 7.x-1.x-dev and kindly share your feedback on the same. thanks