You are here

class MassContactConfirmConverter in Mass Contact 8

Provides upcasting information for mass contact email info to a confirm form.

Hierarchy

Expanded class hierarchy of MassContactConfirmConverter

1 string reference to 'MassContactConfirmConverter'
mass_contact.services.yml in ./mass_contact.services.yml
mass_contact.services.yml
1 service uses MassContactConfirmConverter
mass_contact_confirm_info in ./mass_contact.services.yml
Drupal\mass_contact\ParamConverter\MassContactConfirmConverter

File

src/ParamConverter/MassContactConfirmConverter.php, line 12

Namespace

Drupal\mass_contact\ParamConverter
View source
class MassContactConfirmConverter implements ParamConverterInterface {

  /**
   * Stores the tempstore factory.
   *
   * @var \Drupal\user\PrivateTempStoreFactory
   */
  protected $tempStoreFactory;

  /**
   * Constructs a new MassContactConfirmConverter.
   *
   * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
   *   The factory for the temp store object.
   */
  public function __construct(PrivateTempStoreFactory $temp_store_factory) {
    $this->tempStoreFactory = $temp_store_factory;
  }

  /**
   * {@inheritdoc}
   */
  public function convert($value, $definition, $name, array $defaults) {
    $store = $this->tempStoreFactory
      ->get('mass_contact_confirm_info');
    if ($mass_contact_message_info = $store
      ->get($value)) {
      return $mass_contact_message_info;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function applies($definition, $name, Route $route) {
    if (!empty($definition['type']) && $definition['type'] == 'mass_contact_confirm_info') {
      return TRUE;
    }
    return FALSE;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MassContactConfirmConverter::$tempStoreFactory protected property Stores the tempstore factory.
MassContactConfirmConverter::applies public function Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface::applies
MassContactConfirmConverter::convert public function Converts path variables to their corresponding objects. Overrides ParamConverterInterface::convert
MassContactConfirmConverter::__construct public function Constructs a new MassContactConfirmConverter.