public function ExtraFieldPlusFormManager::getSettingsForm in Extra Field Settings Provider 8
Same name and namespace in other branches
- 8.2 src/Plugin/ExtraFieldPlusFormManager.php \Drupal\extra_field_plus\Plugin\ExtraFieldPlusFormManager::getSettingsForm()
Gets extra field settings form.
Parameters
string $field_name: The extra field machine name.
Return value
array Array with form fields or empty array.
File
- src/
Plugin/ ExtraFieldPlusFormManager.php, line 43
Class
- ExtraFieldPlusFormManager
- Manages Extra Field Plus plugins settings forms.
Namespace
Drupal\extra_field_plus\PluginCode
public function getSettingsForm($field_name) {
if (substr($field_name, 0, 12) === 'extra_field_') {
$plugin_id = substr($field_name, 12);
}
else {
return [];
}
try {
$plugin = $this
->getFactory()
->createInstance($plugin_id);
} catch (Exception $e) {
// Return empty array for wrong plugins.
return [];
}
return $plugin
->getSettingsForm();
}