You are here

function party_settings_get_party_label_plugins in Party 8.2

Gets the available party label plugins and adds their weight from config.

Weights are set at admin/config/party/labels.

Return value

An array of party label plugins sorted by weight.

3 calls to party_settings_get_party_label_plugins()
PartyController::setLabel in includes/party.entity.inc
Set the label on a Party object using the first label plugin (when ordered by weight) that returns a non-empty value.
PartyStorageController::setLabel in lib/Drupal/party/PartyStorageController.php
Set the label on a Party object using the first label plugin (when ordered by weight) that returns a non-empty value.
party_settings_label_plugins_form in ./party.admin.inc
Settings form for choosing the active party label plugin.

File

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

Code

function party_settings_get_party_label_plugins() {

  // Get an array of the available label plugins.
  ctools_include('plugins');
  $label_plugins = ctools_get_plugins('party', 'party_name_label');

  // Add in weights saved previously
  $weights = variable_get('party_label_plugins', array());
  foreach ($label_plugins as $path => $label_plugin) {
    if (isset($weights[$path])) {
      $label_plugins[$path]['weight'] = $weights[$path]['weight'];
    }
  }

  // Sort label plugins array by weight for hook_menu() to figure out the default tab
  // and the admin UI to show them in the right order.
  // drupal_sort_weight() treats a missing weight key as a 0.
  uasort($label_plugins, 'drupal_sort_weight');
  return $label_plugins;
}