public function YamlFormElementManager::getElementPluginId in YAML Form 8
Is an element's plugin id.
Parameters
array $element: A element.
Return value
string An element's $type has a corresponding plugin id, else fallback 'element' plugin id.
Overrides YamlFormElementManagerInterface::getElementPluginId
2 calls to YamlFormElementManager::getElementPluginId()
- YamlFormElementManager::getElementInstance in src/
YamlFormElementManager.php - Get a form element plugin instance for an element.
- YamlFormElementManager::invokeMethod in src/
YamlFormElementManager.php - Invoke a method for specific FAPI element.
File
- src/
YamlFormElementManager.php, line 113
Class
- YamlFormElementManager
- Provides a plugin manager for form element plugins.
Namespace
Drupal\yamlformCode
public function getElementPluginId(array $element) {
if (isset($element['#type'])) {
if ($this
->hasDefinition($element['#type'])) {
return $element['#type'];
}
elseif ($this
->hasDefinition('yamlform_' . $element['#type'])) {
return 'yamlform_' . $element['#type'];
}
}
elseif (isset($element['#markup'])) {
return 'yamlform_markup';
}
return $this
->getFallbackPluginId(NULL);
}