class Quota in Message 8
Maximal (approximate) amount of messages.
Plugin annotation
@MessagePurge(
id = "quota",
label = @Translation("Quota", context = "MessagePurge"),
description = @Translation("Maximal (approximate) amount of messages to keep."),
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\message\MessagePurgeBase implements ContainerFactoryPluginInterface, MessagePurgeInterface uses StringTranslationTrait
- class \Drupal\message\Plugin\MessagePurge\Quota
- class \Drupal\message\MessagePurgeBase implements ContainerFactoryPluginInterface, MessagePurgeInterface uses StringTranslationTrait
Expanded class hierarchy of Quota
1 string reference to 'Quota'
- message.schema.yml in config/
schema/ message.schema.yml - config/schema/message.schema.yml
File
- src/
Plugin/ MessagePurge/ Quota.php, line 18
Namespace
Drupal\message\Plugin\MessagePurgeView source
class Quota extends MessagePurgeBase {
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['quota'] = [
'#type' => 'number',
'#min' => 1,
'#title' => $this
->t('Messages quota'),
'#description' => $this
->t('Maximal (approximate) amount of messages.'),
'#default_value' => $this->configuration['quota'],
'#tree' => FALSE,
];
return parent::buildConfigurationForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$this->configuration['quota'] = $form_state
->getValue('quota');
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'quota' => 1000,
];
}
/**
* {@inheritdoc}
*/
public function fetch(MessageTemplateInterface $template) {
$query = $this
->baseQuery($template);
$result = $query
->range($this->configuration['quota'], 1000000)
->execute();
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessagePurgeBase:: |
protected | property | The entity query object for Message items. | |
MessagePurgeBase:: |
protected | property | The message deletion queue. | |
MessagePurgeBase:: |
protected | property | The weight of the purge plugin. | |
MessagePurgeBase:: |
protected | function | Get a base query. | |
MessagePurgeBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
MessagePurgeBase:: |
public | function |
Returns the purge method description. Overrides MessagePurgeInterface:: |
|
MessagePurgeBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
MessagePurgeBase:: |
public | function |
Returns the weight of the purge plugin. Overrides MessagePurgeInterface:: |
|
MessagePurgeBase:: |
public | function |
Returns the purge method label. Overrides MessagePurgeInterface:: |
|
MessagePurgeBase:: |
public | function |
Process the purgeable messages. Overrides MessagePurgeInterface:: |
|
MessagePurgeBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
MessagePurgeBase:: |
public | function |
Sets the weight for this purge plugin. Overrides MessagePurgeInterface:: |
|
MessagePurgeBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
MessagePurgeBase:: |
public | function |
Constructs a MessagePurgeBase object. Overrides PluginBase:: |
1 |
MessagePurgeInterface:: |
constant | The maximum number of messages that a queue worker should delete at once. | ||
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:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
Quota:: |
public | function |
Form constructor. Overrides MessagePurgeBase:: |
|
Quota:: |
public | function |
Gets default configuration for this plugin. Overrides ConfigurableInterface:: |
|
Quota:: |
public | function |
Fetch the messages that need to be purged for a given template. Overrides MessagePurgeInterface:: |
|
Quota:: |
public | function |
Form submission handler. Overrides MessagePurgeBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
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. |