- πΈπͺSweden thomjjames Sweden
Hi,
I needed something similar for this, importing sports matches so wanted to set a match "status" field to "result" when the item was no longer available in the live feed.
You have to create a new non-configurable (no options) action for it to show up, take a look at core/lib/Drupal/Core/Action/Plugin/Action/SaveAction.php as an example. In the execute method you'd need to set your boolean field value something like:
/** * {@inheritdoc} */ public function execute($entity = NULL) { $entity ->set('field_match_status', 'result') ->setChangedTime($this->time->getRequestTime()) ->save(); }
Hope that helps
Tom