You are here

function menu_bean_get_settings in Menu Bean 7

Get the settings plugins

format of setting info array. Every class should implement SettingInterface

4 calls to menu_bean_get_settings()
MenuBeanType::form in plugins/MenuBeanType.class.php
The Plugin Form
MenuBeanType::values in plugins/MenuBeanType.class.php
Define the form values and their defaults
MenuBeanType::view in plugins/MenuBeanType.class.php
Return the block content.
menu_bean_load_setting_class in ./menu_bean.module
Get the setting class

File

./menu_bean.module, line 44
Bean Plugin definition

Code

function menu_bean_get_settings($key = NULL) {
  $settings =& drupal_static(__FUNCTION__, NULL);
  if (!$settings) {
    $settings = module_invoke_all('menu_bean_setting_info');
    drupal_alter('menu_bean_setting_info', $settings);

    // Only classes that implement SettingInterface will pass
    $settings = array_filter($settings, function ($setting) {
      $ref_class = new ReflectionClass(menu_bean_get_settings_class($setting));
      if (in_array('Drupal\\menu_bean\\Setting\\SettingInterface', $ref_class
        ->getInterfaceNames())) {
        return TRUE;
      }
      return FALSE;
    });
  }
  if ($key) {
    return $settings[$key];
  }
  return $settings;
}