1 views.theme.inc | theme_views_form_views_form($variables) |
Theme function for a View with form elements: replace the placeholders.
File
- core/
modules/ views/ templates/ views.theme.inc, line 1109 - Preprocessors and helper functions to make theme development easier.
Code
function theme_views_form_views_form($variables) {
$form = $variables['form'];
// Placeholders and their substitutions (usually rendered form elements).
$search = array();
$replace = array();
// Add in substitutions provided by the form.
foreach ($form['#substitutions']['#value'] as $substitution) {
$field_name = $substitution['field_name'];
$row_id = $substitution['row_id'];
$search[] = $substitution['placeholder'];
$replace[] = isset($form[$field_name][$row_id]) ? backdrop_render($form[$field_name][$row_id]) : '';
}
// Add in substitutions from hook_views_form_substitutions().
$substitutions = module_invoke_all('views_form_substitutions');
foreach ($substitutions as $placeholder => $substitution) {
$search[] = $placeholder;
$replace[] = $substitution;
}
// Apply substitutions to the rendered output.
$form['output']['#markup'] = str_replace($search, $replace, $form['output']['#markup']);
// Render and add remaining form fields.
return backdrop_render_children($form);
}