class SettingsFactory in Menu Bean 7
Class SettingsFactor @singleton
Hierarchy
- class \Drupal\menu_bean\SettingsFactory
Expanded class hierarchy of SettingsFactory
File
- lib/
Drupal/ menu_bean/ SettingsFactory.php, line 17 - Settings Plugin Factor
Namespace
Drupal\menu_beanView source
class SettingsFactory {
/**
* Get the Settings Form Class
*
* @param $key
* @param $info
* @throws MenuBeanException
* @return SettingInterface
*/
public static function getSettingInstance($key, $info) {
return self::getInstance($key, menu_bean_get_settings_class($info), 'Drupal\\menu_bean\\Form\\SettingInterface');
}
/**
* @param $key
* @param $class
* @param $interface
* @return SettingsFilterInterface|SettingInterface
* @throws MenuBeanException
*/
protected static function getInstance($key, $class, $interface) {
static $instances = array();
if (!isset($instances[$key])) {
$ref_class = new \ReflectionClass($class);
if (in_array($interface, $ref_class
->getInterfaceNames())) {
throw new MenuBeanException("{$interface} does not match " . $class);
}
$instances[$key] = new $class();
}
return $instances[$key];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SettingsFactory:: |
protected static | function | ||
SettingsFactory:: |
public static | function | Get the Settings Form Class |