/** * {@inheritdoc} */ public function completeSale($order, $login = FALSE) { // Empty that cart... $this->emptyCart(); // Force the order to load from the DB instead of the entity cache. // @todo Remove this once uc_payment_enter() can modify order objects? // @todo Should we be overwriting $order with this newly-loaded db_order? $db_order = \Drupal::entityTypeManager()->getStorage('uc_order')->loadUnchanged($order->id()); $order->data = $db_order->data; // Ensure that user creation and triggers are only run once. if (empty($order->data->complete_sale)) { $this->completeSaleAccount($order); // Move an order's status from "In checkout" to "Pending". if ($order->getStateId() == 'in_checkout') { $order->setStatusId(uc_order_state_default('post_checkout')); } $order->save(); // Invoke the checkout complete trigger and hook. $account = $order->getOwner(); \Drupal::moduleHandler()->invokeAll('uc_checkout_complete', array($order, $account)); // rules_invoke_event('uc_checkout_complete', $order); } $type = $order->data->complete_sale; // Log in new users, if requested. if ($type == 'new_user' && $login && $this->currentUser->isAnonymous()) { $type = 'new_user_logged_in'; user_login_finalize($order->getOwner()); } $message = \Drupal::config('uc_cart.messages')->get($type); $message = \Drupal::token()->replace($message, array('uc_order' => $order)); $variables['!new_username'] = isset($order->data->new_user_name) ? $order->data->new_user_name : ''; $variables['!new_password'] = isset($order->password) ? $order->password : t('Your password'); $message = strtr($message, $variables); return array('#theme' => 'uc_cart_complete_sale', '#message' => array('#markup' => $message), '#order' => $order); }
/** * Processes raw profile configuration of a user. */ public static function processUserConf(array $conf, AccountProxyInterface $user) { // Convert MB to bytes $conf['maxsize'] *= 1048576; $conf['quota'] *= 1048576; // Set root uri and url $conf['root_uri'] = $conf['scheme'] . '://'; // file_create_url requires a filepath for some schemes like private:// $conf['root_url'] = preg_replace('@/(?:%2E|\\.)$@i', '', file_create_url($conf['root_uri'] . '.')); // Convert to relative if (!\Drupal::config('imce.settings')->get('abs_urls')) { $conf['root_url'] = file_url_transform_relative($conf['root_url']); } $conf['token'] = $user->isAnonymous() ? 'anon' : \Drupal::csrfToken()->get('imce'); // Process folders $conf['folders'] = static::processUserFolders($conf['folders'], $user); // Call plugin processors \Drupal::service('plugin.manager.imce.plugin')->processUserConf($conf, $user); return $conf; }