You are here

function easy_social_admin_order in Easy Social 7.2

Form callback. Displays Easy Social widget sorting form.

See also

easy_social_menu()

1 string reference to 'easy_social_admin_order'
easy_social_menu in ./easy_social.module
Implements hook_menu().

File

includes/easy_social.admin.inc, line 558
Easy Social admin settings.

Code

function easy_social_admin_order() {
  $widgets = variable_get_value('easy_social_global_order');
  $options = _easy_social_get_options();
  $data = array();
  $i = 0;
  foreach ($widgets as $widget) {
    $data[] = array(
      'id' => $widget,
      'title' => $options[$widget],
      'weight' => $i++,
    );
  }
  $form['widgets'] = array(
    '#tree' => TRUE,
  );
  $count = count($data);
  foreach ($data as $item) {
    $form['widgets'][$item['id']] = array(
      '#widget' => $item['title'],
      'weight' => array(
        '#type' => 'weight',
        '#delta' => $count,
        '#default_value' => isset($item['weight']) ? $item['weight'] : 0,
        '#attributes' => array(
          'class' => array(
            'weight_group',
          ),
        ),
      ),
      'id' => array(
        '#type' => 'hidden',
        '#value' => $item['id'],
      ),
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}