class LegacyMessenger in Service Container 8
Same name and namespace in other branches
- 7.2 src/Messenger/LegacyMessenger.php \Drupal\service_container\Messenger\LegacyMessenger
- 7 src/Messenger/LegacyMessenger.php \Drupal\service_container\Messenger\LegacyMessenger
Class that manage the messages in Drupal.
Hierarchy
- class \Drupal\service_container\Messenger\LegacyMessenger implements MessengerInterface
Expanded class hierarchy of LegacyMessenger
1 file declares its use of LegacyMessenger
- LegacyMessengerTest.php in tests/
src/ Messenger/ LegacyMessengerTest.php - Contains \Drupal\Tests\service_container\Messenger\LegacyMessengerTest.
1 string reference to 'LegacyMessenger'
1 service uses LegacyMessenger
File
- src/
Messenger/ LegacyMessenger.php, line 15 - Contains \Drupal\service_container\LegacyMessenger.
Namespace
Drupal\service_container\MessengerView source
class LegacyMessenger implements MessengerInterface {
/**
* The Drupal 7 legacy service.
*
* @var \Drupal\service_container\Legacy\Drupal7
*/
protected $drupal7;
/**
* Constructs a LegacyMessenger object.
*
* @param \Drupal\service_container\Legacy\Drupal7 $drupal7_service
* The Drupal 7 legacy service.
*/
public function __construct(Drupal7 $drupal7_service) {
$this->drupal7 = $drupal7_service;
}
/**
* {@inheritdoc}
*/
public function addMessage($message, $type = self::STATUS, $repeat = FALSE) {
$this->drupal7
->drupal_set_message($message, $type, $repeat);
return $this;
}
/**
* {@inheritdoc}
*/
public function getMessages() {
return $this->drupal7
->drupal_get_messages(NULL, FALSE);
}
/**
* {@inheritdoc}
*/
public function getMessagesByType($type) {
$messages = $this->drupal7
->drupal_get_messages($type, FALSE);
return isset($messages[$type]) ? $messages[$type] : array();
}
/**
* {@inheritdoc}
*/
public function deleteMessages() {
$this->drupal7
->drupal_get_messages(NULL, TRUE);
return $this;
}
/**
* {@inheritdoc}
*/
public function deleteMessagesByType($type) {
$this->drupal7
->drupal_get_messages($type, TRUE);
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LegacyMessenger:: |
protected | property | The Drupal 7 legacy service. | |
LegacyMessenger:: |
public | function |
Adds a new message to the queue. Overrides MessengerInterface:: |
|
LegacyMessenger:: |
public | function |
Deletes all messages. Overrides MessengerInterface:: |
|
LegacyMessenger:: |
public | function |
Deletes all messages of a certain type. Overrides MessengerInterface:: |
|
LegacyMessenger:: |
public | function |
Gets all messages. Overrides MessengerInterface:: |
|
LegacyMessenger:: |
public | function |
Gets all messages of a certain type. Overrides MessengerInterface:: |
|
LegacyMessenger:: |
public | function | Constructs a LegacyMessenger object. | |
MessengerInterface:: |
constant | An error. | ||
MessengerInterface:: |
constant | A status message. | ||
MessengerInterface:: |
constant | A warning. |