protected function DateRecurModularUtilityTrait::getName in Recurring Date Field Modular Widgets 2.x
Same name and namespace in other branches
- 8 src/DateRecurModularUtilityTrait.php \Drupal\date_recur_modular\DateRecurModularUtilityTrait::getName()
- 3.x src/DateRecurModularUtilityTrait.php \Drupal\date_recur_modular\DateRecurModularUtilityTrait::getName()
Build the name for a sub element.
Parameters
array $element: The element render array.
array $subNames: The full render array path to sub element.
Return value
string The sub element name
2 calls to DateRecurModularUtilityTrait::getName()
- DateRecurModularAlphaWidget::formElement in src/
Plugin/ Field/ FieldWidget/ DateRecurModularAlphaWidget.php - Returns the form for a single field widget.
- DateRecurModularSierraWidget::formElement in src/
Plugin/ Field/ FieldWidget/ DateRecurModularSierraWidget.php - Returns the form for a single field widget.
File
- src/
DateRecurModularUtilityTrait.php, line 86
Class
- DateRecurModularUtilityTrait
- Trait containing convenience methods for dealing with date recur widgets.
Namespace
Drupal\date_recur_modularCode
protected function getName(array $element, array $subNames) : string {
assert($this->fieldDefinition instanceof FieldDefinitionInterface);
$parents = $element['#field_parents'];
$parents[] = $this->fieldDefinition
->getName();
$selector = $root = array_shift($parents);
if ($parents) {
$selector = $root . '[' . implode('][', $parents) . ']';
}
return sprintf('%s[%d][%s]', $selector, $element['#delta'], implode('][', $subNames));
}