function google_tag_form_elements in GoogleTagManager 7.2
Same name in this branch
- 7.2 includes/form/container.inc \google_tag_form_elements()
- 7.2 includes/form/settings.inc \google_tag_form_elements()
Same name and namespace in other branches
- 7 includes/admin.inc \google_tag_form_elements()
Returns form elements from variable definitions.
Parameters
array $variables: Associative array of variable definitions.
object $container: The container configuration object.
Return value
array Associative array of form elements.
2 calls to google_tag_form_elements()
- google_tag_fieldset in includes/
form/ container.inc - Fieldset builder for the module settings form.
- google_tag_fieldset in includes/
form/ settings.inc - Fieldset builder for the module settings form.
File
- includes/
form/ settings.inc, line 152 - Contains the settings form callbacks.
Code
function google_tag_form_elements(array $variables, $container) {
static $keys = array(
'type' => '#type',
'title' => '#title',
'description' => '#description',
'options' => '#options',
'default' => '#default_value',
);
$elements = array();
foreach ($variables as $name => $variable) {
$element = array();
foreach ($keys as $key => $property) {
if (isset($variable[$key])) {
$element[$property] = $variable[$key];
}
}
$element['#type'] = google_tag_form_element_type($element['#type']);
$element['#default_value'] = $container->{$name};
$element += isset($variable['element']) ? $variable['element'] : array();
$elements[$name] = $element;
}
return $elements;
}