You are here

function tracking_code_overview_form in Tracking Code 7

Form for tracking code overview table.

Return value

array a renderable Form API array

1 string reference to 'tracking_code_overview_form'
tracking_code_admin_overview in ./tracking_code.admin.inc
Page callback for tracking code admin page (admin/structure/tracking_code).

File

./tracking_code.admin.inc, line 124
admin page callbacks and form handlers for the tracking code module

Code

function tracking_code_overview_form() {
  $regions = _tracking_code_all_by_region();
  $form = array(
    '#type' => 'form',
    '#theme' => 'tracking_code_overview_table',
    '#theme_wrappers' => array(
      'form',
    ),
  );
  $form['regions'] = array(
    '#type' => 'value',
    '#value' => serialize($regions),
  );
  foreach ($regions as $region => $snippets) {
    foreach ($snippets as $id => $snippet) {

      // Build a form element for each weight attribute.
      $form['tracking_code'][$region]['weight_' . $id] = array(
        '#type' => 'textfield',
        '#default_value' => $snippet->weight,
        '#attributes' => array(
          'class' => array(
            'snippet-weight',
          ),
          'size' => 3,
        ),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}