Builds the checkout progress block.

@return array
A render array.
518571
public function build() {
    $route_name = $this->routeMatch->getRouteName();
    if ($route_name !== 'acm_checkout.form') {
      return [];
    }

    // Load the CheckoutFlow plugin.
    $config = \Drupal::config('acm_checkout.settings');
    $checkout_flow_plugin = $config->get('checkout_flow_plugin') ?: 'multistep_default';
    $plugin_manager = \Drupal::service('plugin.manager.acm_checkout_flow');
    $checkout_flow = $plugin_manager->createInstance($checkout_flow_plugin, []);

    // Build the steps sent to the template.
    $steps = [];
    $visible_steps = array_filter($checkout_flow->getVisibleSteps(), function ($step_definition) {
      return (!isset($step_definition['hide_from_progress']));
    });
    $visible_step_ids = array_keys($visible_steps);
    $current_step_id = $checkout_flow->getStepId();
    $current_step_index = array_search($current_step_id, $visible_step_ids);

    // Get last step completed in the cart.
    $cart = $this->cartStorage;
    $cart_step_id = $cart->getCheckoutStep();
    $cart_step_index = array_search($cart_step_id, $visible_step_ids);

    $index = 0;
    foreach ($visible_steps as $step_id => $step_definition) {
      $is_link = FALSE;
      $completed = FALSE;
      if ($index < $current_step_index) {
        $position = 'previous';
      }
      elseif ($index == $current_step_index) {
        $position = 'current';
      }
      else {
        $position = 'next';
      }

      $label = $step_definition['label'];
      // Add a class if this step has been completed already.
      if ($index < $cart_step_index) {
        $completed = TRUE;
      }
      // Set the label to a link if this step has already been completed so that
      // the progress bar can be used as a sort of navigation.
      if ($index <= $cart_step_index && $index !== $current_step_index) {
        $is_link = TRUE;
        $label = Link::createFromRoute($label, 'acm_checkout.form', [
          'step' => $step_id,
        ])->toString();
      }

      $steps[] = [
        'id' => $step_id,
        'label' => $label,
        'position' => $position,
        'completed' => $completed,
        'is_link' => $is_link,
      ];

      $index++;
    }

    return [
      '#attached' => [
        'library' => ['acm_checkout/checkout_progress'],
      ],
      '#theme' => 'acm_checkout_progress',
      '#steps' => $steps,
    ];
  }
576318
public function update_progress() {
        // If finished...
        if (!$this->is_in_progress_section()) {
            if ($this->bar) {
                $this->end_html();
            }
        } else {
            if (!$this->bar) {
                $this->start_html();
            }
            // In case of indeterminate or small progress, update the wibbler
            // (up to once per second).
            if (time() != $this->lastwibble) {
                $this->lastwibble = time();
                echo \html_writer::div('', 'wibble state' . $this->currentstate);

                // Go on to next colour.
                $this->currentstate += $this->direction;
                if ($this->currentstate < 0 || $this->currentstate >= self::WIBBLE_STATES) {
                    $this->direction = -$this->direction;
                    $this->currentstate += 2 * $this->direction;
                }
                $buffersize = ini_get('output_buffering');
                if (!is_numeric($buffersize)) {
                    // The output_buffering setting can be a number, but can also be "On" or "Off".
                    // If "Off", there's no buffer, if "On", there's no limit to the size. In either case,
                    // there's no point in trying to fill the buffer.
                    $buffersize = 0;
                }
                if ($buffersize) {
                    // Force the buffer full.
                    echo str_pad('', $buffersize);
                }
            }

            // Get progress.
            list ($min, $max) = $this->get_progress_proportion_range();

            // Update progress bar.
            $message = '';
            if ($this->displaynames) {
                $message = $this->get_current_description();
            }
            $this->bar->update_full($min * 100, $message);

            // Flush output.
            flush();
        }
    }
1288388
public function buildTemplate()
    {
        if (!empty($this->template)) {
            return $this->template;
        }

        $columns = [];
        foreach ($this->columnTemplateBuilders as $columnTemplateBuilder) {
            $columns[] = $columnTemplateBuilder->buildTemplate();
        }

        $this->template = [
            'type' => TemplateType::CAROUSEL,
            'columns' => $columns,
        ];

        if ($this->imageAspectRatio) {
            $this->template['imageAspectRatio'] = $this->imageAspectRatio;
        }

        if ($this->imageSize) {
            $this->template['imageSize'] = $this->imageSize;
        }

        return $this->template;
    }
577360
public function buildForm()
    {
        $orderId = $this
            ->paymentBridge
            ->getOrderId();

        $extraData = $this->paymentBridge->getExtraData();
        $formBuilder = $this
            ->formFactory
            ->createNamedBuilder(null);

        if (array_key_exists('transaction_type', $extraData)) {
            $Ds_Merchant_TransactionType = $extraData['transaction_type'];
        } else {
            $Ds_Merchant_TransactionType = '0';
        }

        /**
         * Creates the return route for Redsys.
         */
        $Ds_Merchant_MerchantURL = $this
            ->urlFactory
            ->getReturnRedsysUrl();

        /**
         * Creates the return route, when coming back
         * from Redsys web checkout and proccess is Ok.
         */
        $Ds_Merchant_UrlOK = $this
            ->urlFactory
            ->getReturnUrlOkForOrderId($orderId);

        /**
         * Creates the cancel payment route, when coming back
         * from Redsys web checkout and proccess is error.
         */
        $Ds_Merchant_UrlKO = $this
            ->urlFactory
            ->getReturnUrlKoForOrderId($orderId);

        /**
         * Creates the merchant signature.
         */
        $Ds_Merchant_Amount = $this->paymentBridge->getAmount();
        $Ds_Merchant_Order = $this->formatOrderNumber(
            $this
                ->paymentBridge
                ->getOrderNumber()
        );
        $Ds_Merchant_MerchantCode = $this->merchantCode;
        $Ds_Merchant_Currency = $this->getCurrencyCodeByIso($this->paymentBridge->getCurrency());
        $Ds_Merchant_MerchantSignature = $this->shopSignature(
            $Ds_Merchant_Amount,
            $Ds_Merchant_Order,
            $Ds_Merchant_MerchantCode,
            $Ds_Merchant_Currency,
            $Ds_Merchant_TransactionType,
            $Ds_Merchant_MerchantURL,
            $this->secretKey
        );

        $Ds_Merchant_Terminal = $extraData['terminal'];

        $formBuilder
            ->setAction($this->url)
            ->setMethod('POST')
            ->add('Ds_Merchant_Amount', 'hidden', [
                'data' => $Ds_Merchant_Amount,
            ])
            ->add('Ds_Merchant_MerchantSignature', 'hidden', [
                'data' => $Ds_Merchant_MerchantSignature,
            ])
            ->add('Ds_Merchant_MerchantCode', 'hidden', [
                'data' => $this->merchantCode,
            ])
            ->add('Ds_Merchant_Currency', 'hidden', [
                'data' => $Ds_Merchant_Currency,
            ])
            ->add('Ds_Merchant_Terminal', 'hidden', [
                'data' => $Ds_Merchant_Terminal,
            ])
            ->add('Ds_Merchant_Order', 'hidden', [
                'data' => $Ds_Merchant_Order,
            ])
            ->add('Ds_Merchant_MerchantURL', 'hidden', [
                'data' => $Ds_Merchant_MerchantURL,
            ])
            ->add('Ds_Merchant_UrlOK', 'hidden', [
                'data' => $Ds_Merchant_UrlOK,
            ])
            ->add('Ds_Merchant_UrlKO', 'hidden', [
                'data' => $Ds_Merchant_UrlKO,
            ]);

        /**
         * Optional form fields.
         */
        if (array_key_exists('transaction_type', $extraData)) {
            $formBuilder->add('Ds_Merchant_TransactionType', 'hidden', [
                'data' => $Ds_Merchant_TransactionType,
            ]);
        }

        if (array_key_exists('product_description', $extraData)) {
            $formBuilder->add('Ds_Merchant_ProductDescription', 'hidden', [
                'data' => $extraData['product_description'],
            ]);
        }

        if (array_key_exists('merchant_titular', $extraData)) {
            $formBuilder->add('Ds_Merchant_Titular', 'hidden', [
                'data' => $extraData['merchant_titular'],
            ]);
        }

        if (array_key_exists('merchant_name', $extraData)) {
            $formBuilder->add('Ds_Merchant_MerchantName', 'hidden', [
                'data' => $extraData['merchant_name'],
            ]);
        }

        if (array_key_exists('merchant_data', $extraData)) {
            $formBuilder->add('Ds_Merchant_MerchantData', 'hidden', [
                'data' => $extraData['merchant_data'],
            ]);
        }

        return $formBuilder
            ->getForm()
            ->createView();
    }
55828
protected function render() : string
    {
        $html = '<div class="progress">';

        foreach ($this->values as $k => $value) {
            $styles = $this->styles($value);
            if (strlen($styles) > 0) {
                $styles = 'style="' . trim($styles) . '"';
            }

            $html .= '<div class="progress-bar' . $this->classes($this->bg_colors[$k]) . '" role="progressbar" ' .
                $styles . ' aria-valuenow="' . $value . '" aria-valuemin="0" aria-valuemax="100"></div>';
        }

        $html .= '</div>';

        return $html;
    }
823406
public function renderButton()
    {
        return $this->render('pay-button', [
            'widget' => $this,
            'request' => $this->request,
            'depositRequest' => new DepositRequest([
                'id' => $this->request->id,
                'amount' => $this->depositForm->amount,
                'currency' => $this->depositForm->currency,
                'merchant' => $this->getMerchantName(),
                'finishUrl' => $this->depositForm->finishUrl,
            ])
        ]);
    }
798809
public function newAction() {
        $entity = new Block();
        $form = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form' => $form->createView(),
        );
    }
595841
protected function createProgressBar() {
        /** @var OutputInterface $output */
        /** @noinspection PhpUndefinedFieldInspection */
        $output = $this->command->getOutput();
        $output->writeln('');
        /** @noinspection PhpUndefinedFieldInspection */
        $dimensions = $this->command->getApplication()->getTerminalDimensions();
        $progress = new ProgressBar($output, $dimensions[0]);
        $progress->setFormat('Seeding: <info>' . get_called_class() . "</info>\n%current:4s%/%max:-4s% [%bar%] %percent:4s%% %elapsed:6s%/%estimated:-6s%");

        return $progress;
    }
735372
public function build() {
    $build['content'] = [
      '#theme' => 'dashboard',
      '#items' => $this->dashboardManager->getDashboardItems(),
      '#menu' => $this->systemManager->getBlockContents(),
    ];
    $build['#attached']['library'][] = 'acm/dashboard';

    return $build;
  }
262414
public function getBlockListInfo()
    {
        $blockList = [];
        foreach ($this->getBlockNames() as $blockName) {
            $importBlock = $this->getAggregatedBlock($blockName);
            $currentBlock = $this->getBlock($importBlock->blockData['name'], 'db');
            $blockList[$blockName] = [
                'block_name' => $blockName,
                'display_class' => 'none',
                'update_templates' => -1
            ];
            if ($importBlock->inCategoryTemplates || $importBlock->specifiedPageIds) {
                $blockList[$blockName]['display_class'] = 'info';
            }
            if ($this->hasChanges($importBlock, 'blockData')) {
                $blockList[$blockName]['display_class'] = 'update';
            }
            foreach (['templates', 'repeaterChildBlocks'] as $property) {
                if ($importBlock->$property) {
                    $blockList[$blockName]['update_templates'] = 0;
                }
                if ($this->hasChanges($importBlock, $property)) {
                    $blockList[$blockName]['display_class'] = 'update';
                    $blockList[$blockName]['update_templates'] = 1;
                    break;
                }
            }
            if (!($importBlock->templates || $importBlock->inRepeaterBlocks || $importBlock->inCategoryTemplates || $importBlock->specifiedPageIds)) {
                $blockList[$blockName]['display_class'] = 'delete';
            } elseif (!($currentBlock->templates || $currentBlock->inRepeaterBlocks || $currentBlock->inCategoryTemplates || $currentBlock->specifiedPageIds)) {
                $blockList[$blockName]['display_class'] = ($blockList[$blockName]['display_class'] == 'info') ? 'info' : 'new';
            } elseif ($this->hasChanges($importBlock, 'globalData')) {
                $blockList[$blockName]['display_class'] = 'update';
                $blockList[$blockName]['update_templates'] = 1;
            }
        }
        uasort($blockList, [$this, '_orderBlockChanges']);
        return $blockList;
    }
808147
public function complete()
    {
        $session = $this
            ->getRequest()
            ->getSession();
        
        $site = SiteConfig::current_site_config();
        $id = $this->request->param('ID');
        $error = ($id == "error") ? true : false;

        if ($error) {
            $return = [
                'Title' => _t('SilverCommerce\Checkout.OrderProblem', 'There was a problem with your order'),
                'Content' => $site->dbobject("PaymentFailerContent")
            ];
        } else {
            $return = [
                'Title' => _t('SilverCommerce\Checkout.ThankYouForOrder', 'Thank you for your order'),
                'Content' => $site->dbobject("PaymentSuccessContent")
            ];
        }

        // Add the paid order data to our completed page
        $return["Invoice"] = $this->getEstimate();

        $this->customise($return);

        // Extend our completion process, to allow for custom
        // completion actions
        $this->extend("onBeforeComplete");

        // Clear our session data
        if (!$error && isset($_SESSION)) {
            $session->clear('Checkout.PaymentMethodID');
            $session->clear('Checkout.EstimateID');
        }

        // If we are using the shopping cart, clear that as well
        if (class_exists(ShoppingCartFactory::class)) {
            ShoppingCartFactory::create()->delete();
        }

        return $this->render();
    }
148741
private function render() : string
    {
        $styles = $this->styles();
        if (strlen($styles) > 0) {
            $styles = 'style="' . $this->view->escapeHtmlAttr(trim($styles)) . '"';
        }

        return '
            <div class="progress">
                <div class="progress-bar' . $this->classes() . '" role="progressbar" ' . $styles .
            ' aria-valuenow="' . $this->value . '" aria-valuemin="0" aria-valuemax="100">' .
            (($this->label !== null) ? $this->view->escapeHtml($this->label) : null) . '</div>
            </div>';
    }
423403
public function build()
    {
        $areas = [];
        foreach ($this->areaBuilders as $areaBuilder) {
            $areas[] = $areaBuilder->build();
        }

        return [
            'size' => $this->sizeBuilder->build(),
            'selected' => $this->selected,
            'name' => $this->name,
            'chatBarText' => $this->chatBarText,
            'areas' => $areas,
        ];
    }
88925
protected function loadBlocks()
    {
        if ($this->isLoaded)
            return;

        $blockOwners = $this->getBlockOwners();
        $blocks = array();

        foreach ($blockOwners as $blockOwner) {
            $version = $this->getVersion($blockOwner->getId());

            $owned = $this->blockManager->findByOwner($blockOwner, $version);

            $blocks = array_merge($blocks, $owned);
        }

        $blocks = $this->blockManager->sortBlocks(array_merge($blocks, $blockOwners));
        $cacheKey = $this->getCacheKey();

        $this->blockCache[$cacheKey] = array_filter($blocks, function($item) {
            return ($item instanceof DocumentBlock) ? false : true;
        });

        $this->isLoaded = true;

        return $this;
    }
199899
protected function generate()
    {
        $steps = [
            'Generating module...' => 'generateModule',
            'Optimizing module cache...' => 'optimizeModules',
        ];

        $progress = new ProgressBar($this->output, count($steps));
        $progress->start();

        foreach ($steps as $message => $function) {
            $progress->setMessage($message);

            $this->$function();

            $progress->advance();
        }

        $progress->finish();

        event($this->container['slug'] . '.module.made');

        $this->info("\nModule generated successfully.");
    }
1353405
public function render()
    {
        if (!$this->enableDelete) {
            $this->actions->shift();
        }

        if ($this->actions->isEmpty()) {
            return '';
        }

        $this->setUpScripts();

        $data = [
            'actions'                 => $this->actions,
            'selectAllName'           => $this->grid->getSelectAllName(),
            'isHoldSelectAllCheckbox' => $this->isHoldSelectAllCheckbox,
        ];

        return view('admin::grid.batch-actions', $data)->render();
    }
1154495
public function render()
    {
        $renderer = $this->rendererRegistry->getRenderer($this->rendererName);
        foreach ($this->themes as $theme) {
            $renderer->setBlockTheme($theme[0], $theme[1]);
        }
        $renderer->setFormTheme($this->formThemes);

        return $renderer->renderBlock($this->view);
    }