uc_gc_client-8.x-1.x-dev/src/Plugin/Ubercart/OrderPane/GoCardlessCancel.php

src/Plugin/Ubercart/OrderPane/GoCardlessCancel.php
<?php

namespace Drupal\uc_gc_client\Plugin\Ubercart\OrderPane;

use Drupal\Core\Form\FormStateInterface;
use Drupal\uc_order\EditableOrderPanePluginBase;
use Drupal\uc_order\OrderInterface;

/**
 * Manage the information for the customer's user account.
 *
 * @UbercartOrderPane(
 *   id = "gocardless_cancel",
 *   title = @Translation("Cancel GoCardless mandate"),
 *   weight = 10,
 * )
 */
class GoCardlessCancel extends EditableOrderPanePluginBase {

  /**
   * {@inheritdoc}
   */
  public function getClasses() {
    return ['pos-left'];
  }

  /**
   * {@inheritdoc}
   */
  public function view(OrderInterface $order, $view_mode) {
    if ($view_mode == 'customer') {
      if (\Drupal::currentUser()->hasPermission('view own invoices') && $order->getStatus()->id() <> 'canceled') {
        return \Drupal::formBuilder()->getForm('Drupal\uc_gc_client\Form\MandateCancel', $order);
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(OrderInterface $order, array $form, FormStateInterface $form_state) {}

  /**
   * {@inheritdoc}
   */
  public function submitForm(OrderInterface $order, array &$form, FormStateInterface $form_state) {}

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc