You are here

class PayPalStandard in PayPal for Payment 2.0.x

Same name in this branch
  1. 2.0.x src/Plugin/Payment/MethodConfiguration/PayPalStandard.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalStandard
  2. 2.0.x src/Plugin/Payment/Method/PayPalStandard.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalStandard
Same name and namespace in other branches
  1. 8 src/Plugin/Payment/MethodConfiguration/PayPalStandard.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalStandard

Provides the configuration for the PayPal Standard payment method plugin.

Plugin annotation


@PaymentMethodConfiguration(
  description = @Translation("PayPal Standard payment method type."),
  id = "paypal_payment_standard",
  label = @Translation("PayPal Standard")
)

Hierarchy

  • class \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalBasic extends \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic
    • class \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalStandard

Expanded class hierarchy of PayPalStandard

File

src/Plugin/Payment/MethodConfiguration/PayPalStandard.php, line 18

Namespace

Drupal\paypal_payment\Plugin\Payment\MethodConfiguration
View source
class PayPalStandard extends PayPalBasic {

  /**
   * Gets the email of this configuration.
   *
   * @return string
   */
  public function getEmail() : string {
    return $this->configuration['email'] ?? '';
  }

  /**
   * {@inheritdoc}
   */
  public function processBuildConfigurationForm(array &$element, FormStateInterface $form_state, array &$form) {
    parent::processBuildConfigurationForm($element, $form_state, $form);
    $element['paypal']['email'] = [
      '#type' => 'email',
      '#title' => $this
        ->t('Email'),
      '#default_value' => $this
        ->getEmail(),
      '#maxlength' => 255,
      '#required' => TRUE,
    ];
    return $element;
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    parent::submitConfigurationForm($form, $form_state);
    $parents = $form['plugin_form']['paypal']['#parents'];
    array_pop($parents);
    $values = $form_state
      ->getValues();
    $values = NestedArray::getValue($values, $parents);
    $this->configuration['email'] = $values['paypal']['email'];
  }

  /**
   * @inheritDoc
   */
  public function getDerivativeConfiguration() : array {
    return parent::getDerivativeConfiguration() + [
      'email' => $this
        ->getEmail(),
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PayPalBasic::getLogLevel public function Gets the setting for the log level.
PayPalBasic::isLogging public function Gets the setting for logging the PayPal API traffic.
PayPalBasic::isProduction public function Gets the setting for the production server.
PayPalStandard::getDerivativeConfiguration public function @inheritDoc Overrides PayPalBasic::getDerivativeConfiguration
PayPalStandard::getEmail public function Gets the email of this configuration.
PayPalStandard::processBuildConfigurationForm public function Overrides PayPalBasic::processBuildConfigurationForm
PayPalStandard::submitConfigurationForm public function {} Overrides PayPalBasic::submitConfigurationForm