function _insert_get_insert_type in Insert 8.2
Parameters
string $pluginId:
Return value
string
Throws
Exception when more than one insert type are implemented for the supplied plugin id or no insert type is implemented for the supplied plugin id
2 calls to _insert_get_insert_type()
- insert_field_widget_form_alter in ./
insert.module - Implements hook_field_widget_form_alter().
- insert_field_widget_third_party_settings_form in ./
insert.module - Implements hook_field_widget_third_party_settings_form().
File
- ./
insert.module, line 68
Code
function _insert_get_insert_type($pluginId) {
$widgets = \Drupal::moduleHandler()
->invokeAll('insert_widgets');
$insertType = NULL;
foreach ($widgets as $widgetInsertType => $pluginIds) {
if (in_array($pluginId, $pluginIds)) {
if ($insertType !== NULL) {
throw new Exception('Multiple insert types configured for plugin id ' . $pluginId);
}
$insertType = $widgetInsertType;
}
}
if ($insertType === NULL) {
throw new Exception('No insert type configured for plugin id ' . $pluginId);
}
return $insertType;
}