It's worth it to provide more DS support.

* Expose Entity:title and other "behavior"'ed properties to DS
* Expose ECK entity edit forms to DS
* more?

Comments

OnkelTem’s picture

Issue summary: View changes

asd

OnkelTem’s picture

Status: Active » Needs review
StatusFileSize
new94.6 KB
new9.41 KB

Ok, first attempt.

Patch provides DS support for 'title', 'created' and 'author' fields. Now on Manage Display forms on DS-enabled view mode you can add and configure entity properties (see attached screenshot)

Architecture

It was not easy to decide what would be the best approach in adding DS support. This is what I did:

  • I created new submodule eck_ds.module which is in modules subdirectory
  • DS fields definitions hook is located in eck_ds.ds_fields_info.inc, but has no fields definitions and is simply triggering a new behaviors hook ds_fields_info
  • so the actual DS field definition is in behaviors plugin files: author.inc, title.inc etc

Other modifications

To make it possible to display author information it was required to change API:

  • in eck__entity_type__info($entity_type) a default load hook is assigned to _entity__load value now,
  • which is implemented in function eck__entity__load($entities) { } [eck.entity.inc] which triggers new property behavior hook entity_load with $entities array as argument. This is used in patched author.inc behavior, which implements this hook in function eck_author_property_entity_load($property, $vars) { } and loads users.

Please test and review.

dqd’s picture

Test report:

specs:

  • Ubuntu Linux 12.04.1
  • Apache version 2.2.22
  • MySQL version 5.5.24
  • PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch
  • Drupal 7.16 --dev

git cloned --recursive --branch master http://git.drupal.org/project/eck.git
checked out branch 7.x-2.x
patch http://drupal.org/files/eck-1787460-1.patch applied -v

Checking patch eck.entity.inc...
Hunk #1 succeeded at 557 (offset 14 lines).
Checking patch eck.entity_type.inc...
Checking patch modules/eck_ds.ds_fields_info.inc...
Checking patch modules/eck_ds.info...
Checking patch modules/eck_ds.module...
Checking patch plugins/property_behavior/author.inc...
Checking patch plugins/property_behavior/created.inc...
Checking patch plugins/property_behavior/title.inc...
Applied patch eck.entity.inc cleanly.
Applied patch eck.entity_type.inc cleanly.
Applied patch modules/eck_ds.ds_fields_info.inc cleanly.
Applied patch modules/eck_ds.info cleanly.
Applied patch modules/eck_ds.module cleanly.
Applied patch plugins/property_behavior/author.inc cleanly.
Applied patch plugins/property_behavior/created.inc cleanly.
Applied patch plugins/property_behavior/title.inc cleanly.
> digidog$ drush updb
No database updates required                                                                                                       [success]
Finished performing updates
> digidog$ drush pm-enable eck_ds
The following extensions will be enabled: eck_ds
Do you really want to continue? (y/n): y
eck_ds was enabled successfully.                     

Test installing/enabling/applying patch worked fine without any errors.
Creating an entity and a bundle works without errors. DS options are available.
Created fields in the entity bundle are also available in the system.
The DS patch seems to integrate flawlessly so far. (RTBC?)

Usability discussion: From the usabilities point of view the interface logic of adding fields in nodes is adapted here in ECK, but the principle behind is slidely different. So, looking from top on it, the user will may be confused at first, why she/he has to create an entity, than a bundle and than to add a bundle again, where a bundle is already created. Also, for the user will not be clear what to do with the properties which are looking similar to fields. Maybe there is some documentation or clarification / changing of labels needed to make the underlying concept of ECK or entities in general better understandable? Just a discussable point?

One small drawback: There only seems to exist an uncompatibility with the custom title module (replace core title). Adding a bundle causes the error

Fatal error: Cannot access empty property in /var/www/drupal/sites/all/modules/title/title.module on line 125 

The title property of the entity-type was off in this test. The admin section of the created bundle isn't accessible no more. The error shows on white screen.

After disabling the title module, the error disappers, but the created bundle seems to duplicate. Refreshing the admin section after disabling title module shows two created bundles. But as far as I can see, the title module will become deprecated sooner or later with entities and its bundling logic in core, entity API, ECK or any other entity modules in future. It surely depends on, if core title becomes finally a flexible field like body or an optional entity in the next time. In the moment many modules are sadly still based on the fact, that any node/entity/bundle needs/has a title. (e.g.: node auto label uses core title field). But that's another story ...

Report helpful? RTBC?

jnettik’s picture

Status: Needs review » Reviewed & tested by the community

I tested this out on my site, so far no problems. Also seemed to fix an issue I was having at #1829154: Undefined index for #view_mode.

Edit: Also worth noting my test was against 2.0-rc1

webadpro’s picture

I have tested the patch and everything seems to be working just fine.

mrfelton’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new8.44 KB

Patch updated against latest 3.x dev code

Drupa1ish’s picture

#5 works for me. Thanks!

Drupa1ish’s picture

Drupa1ish’s picture

Issue summary: View changes

more ds support

fmizzell’s picture

Category: Task » Feature request
Issue summary: View changes
dgtlmoon’s picture

Patch #5 fails against current dev, issue closed? unsure

Status: Needs review » Needs work

The last submitted patch, 5: eck-1787460-5.patch, failed testing. View results

dieterholvoet’s picture

Status: Needs work » Closed (won't fix)

We're dropping support for Drupal 7 since it has officially reached end of life on the 5th of January 2025.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.