You are here

function party_settings_label_plugins_form in Party 8.2

Settings form for choosing the active party label plugin.

1 string reference to 'party_settings_label_plugins_form'
party_menu in ./party.module
Implements hook_menu().

File

./party.admin.inc, line 60
Admin page callback file for the party module.

Code

function party_settings_label_plugins_form($form, &$form_state) {

  // @todo: hook_help text for this page.
  $label_plugins = party_settings_get_party_label_plugins();
  $form['#tree'] = TRUE;
  foreach ($label_plugins as $path => $label_plugin) {
    $form['label_plugins'][$path]['name'] = array(
      '#markup' => check_plain($label_plugin['title']),
    );
    $form['label_plugins'][$path]['weight'] = array(
      '#type' => 'weight',
      '#title' => t('Weight for @title', array(
        '@title' => $label_plugin['title'],
      )),
      '#title_display' => 'invisible',
      '#delta' => 10,
      '#default_value' => isset($label_plugin['weight']) ? $label_plugin['weight'] : 0,
    );

    // Generate the edit link if the 'options_form_callback' is set.
    if (isset($label_plugin['options form callback'])) {
      $link = l(t('Edit'), 'admin/config/party/labels/' . $path);
    }
    else {
      $link = '';
    }
    $form['label_plugins'][$path]['edit_link'] = array(
      '#markup' => $link,
    );
  }

  // Include a submit button and weight if more than one label plugin exists.
  if (count($label_plugins) > 1) {
    $form['actions'] = array(
      '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  elseif (isset($label_plugin)) {
    unset($form['label_plugins'][$path]['weight']);
  }
  return $form;
}