You are here

class MentionsInsert in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  2. 8 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  3. 8.2 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  4. 8.3 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  5. 8.4 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  6. 8.6 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  7. 8.7 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  8. 8.8 modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  9. 10.3.x modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  10. 10.0.x modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  11. 10.1.x modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert
  12. 10.2.x modules/custom/mentions/src/EventSubscriber/MentionsInsert.php \Drupal\mentions\EventSubscriber\MentionsInsert

MentionsInsert handles event 'mentions.insert'.

Hierarchy

  • class \Drupal\mentions\EventSubscriber\MentionsInsert implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of MentionsInsert

File

modules/custom/mentions/src/EventSubscriber/MentionsInsert.php, line 10

Namespace

Drupal\mentions\EventSubscriber
View source
class MentionsInsert implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events['mentions.insert'][] = [
      'onMentionsInsert',
      0,
    ];
    return $events;
  }

  /**
   * Event Handler.
   */
  public function onMentionsInsert($event) {
    $config = \Drupal::config('mentions.mentions');
    $config_mentions_events = $config
      ->get('mentions_events');
    $action_id = $config_mentions_events['insert'];
    if (empty($action_id)) {
      return;
    }
    $entity_storage = \Drupal::entityManager()
      ->getStorage('action');
    $action = $entity_storage
      ->load($action_id);
    $action_plugin = $action
      ->getPlugin();
    if (!empty($action_id)) {
      $action_plugin
        ->execute(FALSE);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MentionsInsert::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
MentionsInsert::onMentionsInsert public function Event Handler.