Programmatically setting unpublish state value

Created on 25 January 2023, almost 2 years ago
Updated 17 June 2023, over 1 year ago

Is there a way to programmatically set Unpublished state value when node is saved?

I have an event content which have event ending date and time. So when I save a event, I want to make sure that event date and time is added to Scheduler Unpublished on field by doing

$node->set('unpublish_on', $event_end_date);

however if I do similar to Unpublished state field provided by scmi module it doesn't save a value. For example.

$node->set('unpublish_state', 'Archived');

OR

$node->set('unpublish_state', 'archived');

Any idea?

πŸ’¬ Support request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom drs2034

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024