social_media.api.php in Social media share 8
File
social_media.api.php
View source
<?php
namespace Drupal\social_media\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class SocialMediaSubscriber implements EventSubscriberInterface {
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;
}
public function addMoreSocialMedia($event) {
$element = $event
->getElement();
$element['google_plus'] = 'Google plus';
$event
->setElement($element);
}
public function executeSocialMedia($event) {
$element = $event
->getElement();
$element['facebook_share']['weight'] = 8;
$event
->setElement($element);
}
public function renderSocialMedia($event) {
$element = $event
->getElement();
$element['facebook_msg']['text'] = 'New facebook msg text';
$event
->setElement($element);
}
}