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.
SInce it is a very useful feature to have an entity published or not it would be nice to see this feature implemented in ECK for Dr8.
Comment | File | Size | Author |
---|---|---|---|
#10 | add_status_field-2924320-10.patch | 12.18 KB | eugene.brit |
#8 | interdiff-7-8.patch | 374 bytes | bgilhome |
#8 | add_status_field-2924320-8.patch | 12.11 KB | bgilhome |
| |||
#7 | interdiff-5-7.txt | 2.76 KB | bgilhome |
#7 | add_status_field-2924320-7.patch | 12.08 KB | bgilhome |
|
Comments
Comment #2
init90Here is an initial patch that adds 'status' field support. Note that patch doesn't provide UI,
most likely it should be added in a separate issue.Comment #3
init90This patch adds UI and extends tests for the 'status' field.
Comment #4
maestro888 CreditAttribution: maestro888 at Drupal Ukraine Community, ZANZARRA Drupal Agency commentedI've tested this solution in the Entity context. All is well.
I've tested this solution in context Bundle. All is well.
Also, I`m deleted bundle and deleted Entity. All is well.
Comment #5
bgilhome CreditAttribution: bgilhome commentedI get errors like "Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Entity\ContentEntityBase->getEntityKey()" when the entity builder tries to get the key for 'published' (e.g. rendering entities in a view).
Updated patch adds the entity key for 'published', attached with interdiff from #3.
Comment #6
pifagorComment #7
bgilhome CreditAttribution: bgilhome commentedIt seems the isPublished() method is not returning the correrct result - I had to override it and manually get the status field value for it to work.
I've also added a permission 'view unpublished eck entities' and added it to the access check (it overrides view own/any type-specific permissions, not sure what the usual approach is here).
Finally, I added hasStatusField() method to EckEntityType - not sure where this and the other hasXXField methods are used but thought it best to add it for consistency.
Patch and interdiff attached.
Comment #8
bgilhome CreditAttribution: bgilhome commentedNeed to check hasField() first to for the status field - updated patch & interdiff attached.
Comment #9
MichelleI'm trying this out and it's not saving a change to the published status. If I uncheck it and save and then edit again, it's still checked. I'm going to dig into the code to try to figure it out.
Edit: I tried and failed to find the issue. I'm going to have to switch to doing a work around for what I need. Hopefully someone else can figure out the problem because I think this is a good addition to the module.
Comment #10
eugene.britIf you need revisions and status field on your site:
Otherwise, you can ignore this patch.
Comment #11
MurzThanks, patch become works well when I run updates via
drush updb()
after applying patch!Comment #12
MurzAlso note, that on Drupal 8.9.3 with PHP 7.1 update process fails with error:
Upgrade PHP to 7.4 resolve this problem.
@Michelle, maybe you miss with step to apply updates, or have old php version?
Comment #15
MatroskeenLet's get this in!
I've committed a patch from #8 and additional test coverage for "view unpublished eck entities" permission. I also applied one change to the access controller to make the access control more granular - users will have access to unpublish entities only if they already have "view own ..." or "view any ..." permission for this particular entity type.
Just for the record, I wasn't able to reproduce the issues described in #9.
Thanks, everyone!
Comment #17
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedI created a separate module since this feature hasn't been included in a tagged release yet: https://www.drupal.org/project/eck_status_field
Comment #18
liberatrThanks for that module @DieterHolvoet -- we will look into using your module. This code is in the dev branch of eck, but not a release. Currently we are using 1.0.0-beta2 with these two patches applied:
https://git.drupalcode.org/project/eck/-/commit/6831279456ea438ea0b1d4db...
https://git.drupalcode.org/project/eck/-/commit/b014cf923258be5b2692c02c...
The project I am on wants to avoid -dev releases if at all possible.