SetOrderStatus.php in Ubercart 8.4
Namespace
Drupal\uc_order\Plugin\RulesActionFile
uc_order/src/Plugin/RulesAction/SetOrderStatus.phpView source
<?php
namespace Drupal\uc_order\Plugin\RulesAction;
use Drupal\rules\Core\RulesActionBase;
use Drupal\uc_order\OrderInterface;
use Drupal\uc_order\Entity\OrderStatus;
/**
* Provides a 'Set order status' action.
*
* @RulesAction(
* id = "uc_order_update_status",
* label = @Translation("Update the order status"),
* category = @Translation("Order"),
* context_definitions = {
* "order" = @ContextDefinition("entity:uc_order",
* label = @Translation("Order")
* ),
* "order_status" = @ContextDefinition("string",
* label = @Translation("Status"),
* list_options_callback = "getOptionsList"
* )
* }
* )
*/
class SetOrderStatus extends RulesActionBase {
/**
* Order status options callback.
*/
public function getOptionsList() {
return OrderStatus::getOptionsList();
}
/**
* Updates an order's status.
*
* @param \Drupal\uc_order\OrderInterface $order
* The order entity.
* @param string $status
* The order status.
*/
protected function doExecute(OrderInterface $order, $status) {
$order
->setStatusId($status)
->save();
}
}
Classes
Name![]() |
Description |
---|---|
SetOrderStatus | Provides a 'Set order status' action. |