/** * Checks access to fulfill this order. * * @param \Drupal\uc_order\OrderInterface $order * The Order to check access for. * * @return \Drupal\Core\Access\AccessResultInterface * The access result. */ public function accessOrder(OrderInterface $uc_order) { $account = \Drupal::currentUser(); return AccessResult::allowedIf($account->hasPermission('fulfill orders') && $uc_order->isShippable()); }
/** * {@inheritdoc} */ public function view(OrderInterface $order, $view_mode) { if ($view_mode != 'customer' || $order->isShippable()) { return parent::view($order, $view_mode); } }