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
The codebase has calls to \Drupal\Core\Entity\EntityPublishedInterface::setPublished()
with a parameter TRUE
/ FALSE
. However, calling setPublished() with a parameter is deprecated since we have specialized methods available.
Issue: #2789315: Create EntityPublishedInterface and use for Node and Comment
Change record: https://www.drupal.org/node/2830201
Proposed resolution
- Replace
setPublished(TRUE)
withsetPublished()
- Replace
setPublished(FALSE)
withsetUnpublished()
Comment | File | Size | Author |
---|---|---|---|
#2 | scheduler-published_parameter_deprecated-3034805-2.patch | 2.49 KB | idebr |
|
Comments
Comment #2
idebr CreditAttribution: idebr at ezCompany commentedAttached patch:
setPublished(TRUE)
withsetPublished()
setPublished(FALSE)
withsetUnpublished()
Comment #3
thallesWorks for me!
@see:
Comment #5
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedThank you. Committed.
Comment #6
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedLinked to parent issue.
Comment #7
jonathan1055 CreditAttribution: jonathan1055 as a volunteer commentedFixed link to change record. The [#issuenumber] syntax only works for nodes in a project issue queue.
For the record this fix removed 39 deprecation failures from 13 tests: Token, ContentListAccess, Revisioning, Required, PastDates, NonEnabled, NodeAccess, Multilingual, FieldsDisplay, DeleteNode, DefaultTime, Basic, Api