public function CheckinMerciLineItem::execute in MERCI (Manage Equipment Reservations, Checkout and Inventory) 8.2
Executes the plugin.
Overrides ExecutableInterface::execute
File
- modules/
merci_line_item/ src/ Plugin/ Action/ CheckinMerciLineItem.php, line 39
Class
- CheckinMerciLineItem
- Promotes a merci_line_item.
Namespace
Drupal\merci_line_item\Plugin\ActionCode
public function execute($entity = NULL) {
$checkin_date = new DrupalDateTime($this->configuration['checkin_date']);
$checkin_date
->setTimezone(new \DateTimezone(DATETIME_STORAGE_TIMEZONE));
$checkin_string = $checkin_date
->format(DATETIME_DATETIME_STORAGE_FORMAT);
$checkin_date_field = 'field_checkin';
$entity
->set($checkin_date_field, $checkin_string);
$entity
->set('field_reservation_status', 'checked_in');
$entity
->save();
}