When creating a DsField plugin in the annotation you need to define the entity_type. This only accepts one value while their are use-cases where you would like to use this field across entity types. Be it a simple field for social media integration, working with start and end-dates or some other shared functionality.

I propose we add code to Ds.php to enable the use of an array in the entity_type annotation.

Comments

Zerdiox created an issue. See original summary.

zerdiox’s picture

StatusFileSize
new951 bytes

I've added a patch with code that enables what I suggested.

EDIT: Patch was bad, added a new one.

zerdiox’s picture

StatusFileSize
new702 bytes

New patch

zerdiox’s picture

StatusFileSize
new1.05 KB

Third times a charm?

zerdiox’s picture

StatusFileSize
new858 bytes
aspilicious’s picture

Status: Active » Needs review
aspilicious’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Algeron’s picture

StatusFileSize
new757 bytes

Patch was not relative to the DS module.

Status: Needs review » Needs work

The last submitted patch, 8: annotation_entity_type_2781141_6.patch, failed testing.

The last submitted patch, 8: annotation_entity_type_2781141_6.patch, failed testing.

The last submitted patch, 8: annotation_entity_type_2781141_6.patch, failed testing.

aspilicious’s picture

There also needs to be a small test.
This is a fairly easy task for anyone that wants to write a test.

Algeron’s picture

Status: Needs work » Needs review
StatusFileSize
new716 bytes

Patch was still borked. Uploaded a new one.

swentel’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests
+++ b/src/Ds.php
@@ -27,7 +27,13 @@ class Ds {
+        } else {
+          $static_fields[$plugin['entity_type']][$plugin_id] = $plugin;
+        }

'else' needs to go on a new line.

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new2.29 KB

Lets see if this gets green.

Status: Needs review » Needs work

The last submitted patch, 15: 2781141-15.patch, failed testing.

aspilicious’s picture

Status: Needs work » Needs review
StatusFileSize
new3.44 KB

Another try

  • aspilicious committed 35de455 on 8.x-3.x
    Issue #2781141 by Zerdiox, Algeron, aspilicious: Annotation entity_type...
aspilicious’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.