You are here

function sms_user_entity_insert in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_user/sms_user.module \sms_user_entity_insert()
  2. 2.1.x modules/sms_user/sms_user.module \sms_user_entity_insert()

Implements hook_entity_insert().

File

modules/sms_user/sms_user.module, line 27
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_entity_insert(EntityInterface $entity) {

  // Rebuild dynamic menu links if phone number settings for 'user' added.
  if ($entity instanceof PhoneNumberSettingsInterface && $entity
    ->getPhoneNumberEntityTypeId() == 'user') {

    /** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link */
    $menu_link = \Drupal::service('plugin.manager.menu.link');
    $menu_link
      ->rebuild();
  }
}