Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I created an entity type and bundle that did not have a Title field and attempted to create a view using the table format. Because views assumes Title field will be available when creating the table format, we get an error as below screenshot.
Proposed resolution
When creating a table view, check first that the Title field exists. If not available, don't add it as a default field.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#14 | 2811629-14.patch | 821 bytes | osopolar |
screencapture-drupalvm-dev-admin-structure-views-view-travel_story_email_subscriptions-1475661919559.png | 1005.65 KB | rachel_norfolk |
Issue fork eck-2811629
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dawehnerThis could also be a bug of the module you try to leverage.
\Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplayOptions
tries to detect which field it could use. If modules give a hint which fields should be chosen:$default_field = $data['table']['base']['defaults']['field'];
it accepts that.Comment #3
rachel_norfolkWas just ECK, really.
Comment #4
dawehner"just" ECK, haha, you made my day. ECK isn't even revisionable
Comment #8
larowlanSo the 'field' is set by this hunk in EntityViewsData
Which is correctly checking that the entity-type has a label key.
The issue is in ECK module that always tells Drupal it has a label field named title.
Comment #9
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedI'm getting a similar error:
Removing the label entity key from the entity type definition if it isn't enabled seems to fix the issue.
Comment #11
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedComment #13
osopolarI had an issue running
drush simple-sitemap:rebuild-queue
(drush ssr) for a eck entity related sitemap, resulting in the following error, which was hard to understand:In my case it was not the 'title' but the 'status' field (published => status).
Copy of patch from MR !29 attached, to be used with composer, see "Patches from drupal.org merge request URLs are dangerous?".
Comment #14
osopolar