You are here

function easy_social_get_widgets in Easy Social 8.4

Same name and namespace in other branches
  1. 8.3 easy_social.module \easy_social_get_widgets()
  2. 7.2 easy_social.module \easy_social_get_widgets()

Return the available widgets.

Return value

array An array of widget names, keyed by their machine_name.

3 calls to easy_social_get_widgets()
EasySocialSettingsForm::buildForm in src/Form/EasySocialSettingsForm.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
easy_social_preprocess_easy_social in ./easy_social.module
Implements hook_preprocess_HOOK() for easy_social theme.
_easy_social_preprocess_widget in ./easy_social.module
Custom pre-process function, used to add settings for widgets.

File

./easy_social.module, line 17
Easy Social module.

Code

function easy_social_get_widgets() {

  // Use the advanced drupal_static() pattern.
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['widgets'] =& drupal_static(__FUNCTION__);
  }
  $widgets =& $drupal_static_fast['widgets'];
  if (!isset($widgets)) {

    // Allow modules to define widgets.
    $widgets = \Drupal::moduleHandler()
      ->invokeAll('easy_social_widget');

    // Allow modules to alter the defined widgets.
    \Drupal::moduleHandler()
      ->alter('easy_social_widget', $widgets);
  }
  return $widgets;
}