class SocialMediaSubscriber in Social media share 8
Listens to the dynamic route events.
Hierarchy
- class \Drupal\social_media\EventSubscriber\SocialMediaSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of SocialMediaSubscriber
File
- ./
social_media.api.php, line 10
Namespace
Drupal\social_media\EventSubscriberView source
class SocialMediaSubscriber implements EventSubscriberInterface {
/**
* Public static method used by Drupals event.
*
* @return mixed
* Array of events we subscribe to.
*/
public static function getSubscribedEvents() {
$events = [];
$events['social_media.add_more_social_media'][] = [
'addMoreSocialMedia',
39,
];
$events['social_media.pre_execute'][] = [
'executeSocialMedia',
39,
];
$events['social_media.pre_render'][] = [
'renderSocialMedia',
39,
];
return $events;
}
/**
* Subscribes to social_media.add_more_social_media event.
*/
public function addMoreSocialMedia($event) {
$element = $event
->getElement();
$element['google_plus'] = 'Google plus';
$event
->setElement($element);
}
/**
* Subscribes to social_media.pre_execute event.
*/
public function executeSocialMedia($event) {
$element = $event
->getElement();
$element['facebook_share']['weight'] = 8;
$event
->setElement($element);
}
/**
* Subscribes to social_media.pre_render event.
*/
public function renderSocialMedia($event) {
$element = $event
->getElement();
$element['facebook_msg']['text'] = 'New facebook msg text';
$event
->setElement($element);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SocialMediaSubscriber:: |
public | function | Subscribes to social_media.add_more_social_media event. | |
SocialMediaSubscriber:: |
public | function | Subscribes to social_media.pre_execute event. | |
SocialMediaSubscriber:: |
public static | function | Public static method used by Drupals event. | |
SocialMediaSubscriber:: |
public | function | Subscribes to social_media.pre_render event. |