abstract class PushBase in Open Social 10.3.x
Same name and namespace in other branches
- 8.9 modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
- 8.7 modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
- 8.8 modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
- 10.0.x modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
- 10.1.x modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
- 10.2.x modules/custom/activity_send/modules/activity_send_push_notification/src/PushBase.php \Drupal\activity_send_push_notification\PushBase
Class PushBase.
@package Drupal\activity_send_push_notification
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\activity_send_push_notification\PushBase implements PushInterface uses StringTranslationTrait
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of PushBase
File
- modules/
custom/ activity_send/ modules/ activity_send_push_notification/ src/ PushBase.php, line 17
Namespace
Drupal\activity_send_push_notificationView source
abstract class PushBase extends PluginBase implements PushInterface {
use StringTranslationTrait;
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The current active user ID.
*
* @var int
*/
protected $currentUserId;
/**
* Constructs a PushBase object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* The string translation service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
* @param int $current_user_id
* The current active user ID.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, TranslationInterface $string_translation, ConfigFactoryInterface $config_factory, $current_user_id) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this
->setStringTranslation($string_translation);
$this->configFactory = $config_factory;
$this->currentUserId = $current_user_id;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('string_translation'), $container
->get('config.factory'), $container
->get('current_user')
->id());
}
/**
* {@inheritdoc}
*/
public function access() {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function buildForm() {
return [];
}
/**
* {@inheritdoc}
*/
public function submitForm(FormStateInterface $form_state) {
}
/**
* Returns the submitted form value for a specific key.
*
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
* @param string|array $key
* Values are stored as a multi-dimensional associative array. If $key is a
* string, it will return $values[$key]. If $key is an array, each element
* of the array will be used as a nested key. If $key = array('foo', 'bar')
* it will return $values['foo']['bar'].
* @param mixed $default
* (optional) The default value if the specified key does not exist.
*
* @return mixed
* The value for the given key, or NULL.
*/
protected function getFormValue(FormStateInterface $form_state, $key, $default = NULL) {
if (!is_array($key)) {
$key = [
$key,
];
}
$key = array_merge([
'push_notifications',
$this
->getPluginId(),
], $key);
return $form_state
->getValue($key, $default);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PushBase:: |
protected | property | The configuration factory. | |
PushBase:: |
protected | property | The current active user ID. | |
PushBase:: |
public | function |
Check access. Overrides PushInterface:: |
|
PushBase:: |
public | function |
Build form elements. Overrides PushInterface:: |
|
PushBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
PushBase:: |
protected | function | Returns the submitted form value for a specific key. | |
PushBase:: |
public | function |
Save plugin settings. Overrides PushInterface:: |
|
PushBase:: |
public | function |
Constructs a PushBase object. Overrides PluginBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |