You are here

function _prepare_template_form_variables in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 shareaholic.module \_prepare_template_form_variables()

Prepares the form for use in the templates by storing the form as strings in the $variables object that can be printed in the template

3 calls to _prepare_template_form_variables()
template_preprocess_shareaholic_apps_configuration in includes/shareaholic_apps_configuration_form.php
Prepare variables to be used in the shareaholic_apps_configuration template
template_preprocess_shareaholic_failure_modal in includes/shareaholic_failure_modal.php
Prepare variables to be used in the shareaholic_failure_modal template
template_preprocess_shareaholic_tos_modal in includes/shareaholic_tos_modal.php
Prepare variables to be used in the shareaholic_tos_modal template

File

./shareaholic.module, line 186
Allows site owner to add share buttons/recommendations on their website

Code

function _prepare_template_form_variables(&$variables, $form_id) {
  $variables[$form_id] = array();
  $hidden = array();
  foreach (element_children($variables['form']) as $key) {
    $type = $variables['form'][$key]['#type'];
    if ($type == 'hidden' || $type == 'token') {
      $hidden[] = drupal_render($variables['form'][$key]);
    }
    else {
      $variables[$form_id][$key] = drupal_render($variables['form'][$key]);
    }
  }
  $variables[$form_id]['hidden'] = implode($hidden);
}