CheckoutPanePluginBase.php in Ubercart 8.4
File
uc_cart/src/CheckoutPanePluginBase.php
View source
<?php
namespace Drupal\uc_cart;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\uc_order\OrderInterface;
abstract class CheckoutPanePluginBase extends PluginBase implements CheckoutPanePluginInterface {
protected $status = TRUE;
protected $weight = '';
public function isEnabled() {
return $this->status;
}
public function getWeight() {
return $this->weight;
}
public function __construct(array $configuration, $plugin_id, array $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this
->setConfiguration($configuration);
}
public function getConfiguration() {
return [
'status' => $this
->isEnabled(),
'weight' => $this
->getWeight(),
'settings' => $this->configuration,
];
}
public function setConfiguration(array $configuration) {
$configuration += [
'status' => $this->pluginDefinition['status'],
'weight' => $this->pluginDefinition['weight'],
'settings' => [],
];
$this->status = $configuration['status'];
$this->weight = $configuration['weight'];
$this->configuration = $configuration['settings'] + $this
->defaultConfiguration();
return $this;
}
public function defaultConfiguration() {
return [];
}
public function prepare(OrderInterface $order, array $form, FormStateInterface $form_state) {
}
public function process(OrderInterface $order, array $form, FormStateInterface $form_state) {
return TRUE;
}
public function settingsForm() {
}
public function getTitle() {
return (string) $this->pluginDefinition['title'];
}
}