You are here

public function ContactMessageResource::__construct in Contact message REST 8

Constructs a Drupal\rest\Plugin\ResourceBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

array $serializer_formats: The available serialization formats.

\Psr\Log\LoggerInterface $logger: A logger instance.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

\Drupal\Core\Session\AccountProxyInterface $current_user: The current user.

\Drupal\Core\Flood\FloodInterface $flood: The flood control mechanism.

\Drupal\contact\MailHandlerInterface $mail_handler: The contact mail handler service.

\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter service.

Overrides ResourceBase::__construct

File

src/Plugin/rest/resource/ContactMessageResource.php, line 116
Contains \Drupal\contact_message_rest\Plugin\rest\resource\ContactMessageResource.

Class

ContactMessageResource
Creates a resource for adding contact Message entities and sending them.

Namespace

Drupal\contact_message_rest\Plugin\rest\resource

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, ConfigFactoryInterface $config_factory, AccountProxyInterface $current_user, FloodInterface $flood, MailHandlerInterface $mail_handler, DateFormatterInterface $date_formatter) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);
  $this->config = $config_factory
    ->get('contact.settings');
  $this->currentUser = $current_user;
  $this->flood = $flood;
  $this->mailHandler = $mail_handler;
  $this->dateFormatter = $date_formatter;
}