function _popup_form in Popup 8
Same name and namespace in other branches
- 7 includes/popup.api.inc \_popup_form()
- 7.x includes/popup.api.inc \_popup_form()
- 6.x includes/popup.api.inc \_popup_form()
File
- includes/
popup.api.inc, line 374
Code
function _popup_form($attributes, $return = FALSE) {
$title = $attributes['title'] ? $attributes['title'] : 'form';
if ($return == 'title') {
return $title;
}
// Initialize args attribute.
$attributes += array(
'args' => array(),
);
// Add form_id at the beginning of the args array.
array_unshift($attributes['args'], $attributes['form']);
// Render form.
$form = call_user_func_array('drupal_get_form', $attributes['args']);
$body = \Drupal::service('renderer')
->render($form);
if ($attributes['ajax']) {
$body = '<div class="ajax-form-wrapper">' . $body . '</div>';
}
if ($return == 'body') {
return $body;
}
return popup_element($title, $body, $attributes);
}