You are here

function linkit_profiles_reorder in Linkit 7.2

Form for reorder profiles.

1 string reference to 'linkit_profiles_reorder'
linkit_menu in ./linkit.module
Implements hook_menu().

File

plugins/export_ui/linkit_profiles.inc, line 343

Code

function linkit_profiles_reorder() {
  $profiles = linkit_profile_load_all();
  $form = array();
  $form['#tree'] = TRUE;

  // Sort by weight.
  uasort($profiles, '_linkit_sort_profiles_by_weight');
  foreach ($profiles as $profile_machine_name => $profile) {
    $form['profiles'][$profile_machine_name] = array(
      'name' => array(
        '#markup' => $profile->admin_title,
      ),
      'roles' => array(
        '#markup' => linkit_profiles_ui::buildRoleList($profile->role_rids),
      ),
      'weight' => array(
        '#type' => 'weight',
        '#title' => t('Weight for @title', array(
          '@title' => $profile->admin_title,
        )),
        '#title_display' => 'invisible',
        '#default_value' => isset($profile->weight) ? $profile->weight : LINKIT_DEFAULT_WEIGHT,
        '#attributes' => array(
          'class' => array(
            'weight',
          ),
        ),
      ),
    );
  }
  if (!$profiles) {
    $form['helptext'] = array(
      '#markup' => t('No profiles found.'),
    );
  }
  else {
    $form['helptext'] = array(
      '#markup' => t('If a user have multiple roles, the profile weight will determine which profile to use. Lower weight will take precedence.'),
    );
    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  return $form;
}