You are here

function blockreference_get_block_modules in Block reference 6

Same name and namespace in other branches
  1. 7 blockreference.module \blockreference_get_block_modules()

Get an array of block modules, where the keys are the module short name and the values are the module name as set in the .info file.

1 call to blockreference_get_block_modules()
blockreference_field_settings in ./blockreference.module
Implementation of hook_field_settings().

File

./blockreference.module, line 85
Defines a field type for referencing a block from a node.

Code

function blockreference_get_block_modules() {
  $block_modules = array();

  // Get current list of modules
  $files = drupal_system_listing('\\.module$', 'modules', 'name', 0);

  // Extract current files from database.
  system_get_files_database($files, 'module');

  // Get modules that define blocks.
  $modules = module_implements('block', TRUE);
  foreach ($modules as $module) {
    if (isset($files[$module])) {
      $file =& $files[$module];

      // Look for the info file.
      $file->info = drupal_parse_info_file(dirname($file->filename) . '/' . $file->name . '.info');
      $block_modules[$module] = isset($file->info['name']) ? $file->info['name'] : ucfirst($module);
    }
  }
  return $block_modules;
}