You are here

function _custom_breadcrumbs_get_module_weight in Custom Breadcrumbs 7.2

Same name and namespace in other branches
  1. 6.2 custom_breadcrumbs.module \_custom_breadcrumbs_get_module_weight()

Retrieves active module weights from the database.

@codingStandardsIgnoreStart

Parameters

array $names: An array of module names.

Return value

array An array of module weightsm indexed by module name and ordered by weight.

5 calls to _custom_breadcrumbs_get_module_weight()
custom_breadcrumbs_module_weight in ./custom_breadcrumbs.admin.inc
Lists and manages custom breadcrumb module weights.
custom_breadcrumbs_panels_ctools_render_alter in custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
Implements hook_ctools_render_alter().
custom_breadcrumbs_panels_node_view in custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
Implements hook_node_build_alter().
custom_breadcrumbs_taxonomy_enable in custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.install
Implements hook_enable().
custom_breadcrumbs_taxonomy_minimum_module_weight in custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.module
Implements hook_minimum_module_weight().

File

./custom_breadcrumbs.module, line 1265
Main file for the Custom breadcrumbs.

Code

function _custom_breadcrumbs_get_module_weight($names) {

  // @codingStandardsIgnoreEnd
  $weights = array();
  $query = db_select('system', 's')
    ->fields('s', array(
    'name',
    'weight',
  ))
    ->condition('name', $names, 'IN')
    ->condition('status', 1)
    ->orderBy('weight', 'ASC');
  $results = $query
    ->execute();

  // @codingStandardsIgnoreLine
  // $results = db_query("SELECT name, weight FROM {system} WHERE name IN (" . db_placeholders($names, 'text') . ") AND status = 1 ORDER BY weight ASC", $names);.
  foreach ($results as $row) {
    $weights[$row->name] = (int) $row->weight;
  }
  return $weights;
}