Projet

Général

Profil

Révision 30d5b9c5

Ajouté par Mathieu Schiano Di Schiabica il y a environ 8 ans

Update to 7.42

Voir les différences:

drupal7/modules/block/block.module
16 16
define('BLOCK_CUSTOM_FIXED', 0);
17 17

  
18 18
/**
19
 *  Shows this block by default, but lets individual users hide it.
19
 * Shows this block by default, but lets individual users hide it.
20 20
 */
21 21
define('BLOCK_CUSTOM_ENABLED', 1);
22 22

  
......
59 59
      $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can <a href="@block-add">add custom blocks</a>, which are then listed on the <a href="@blocks">Blocks administration page</a>. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'), '@block-add' => url('admin/structure/block/add'))) . '</dd>';
60 60
      $output .= '</dl>';
61 61
      return $output;
62

  
62 63
    case 'admin/structure/block/add':
63 64
      return '<p>' . t('Use this page to create a new custom block.') . '</p>';
64 65
  }
......
189 190
 * @param $theme
190 191
 *   The theme whose blocks are being configured. If not set, the default theme
191 192
 *   is assumed.
193
 *
192 194
 * @return
193 195
 *   The theme that should be used for the block configuration page, or NULL
194 196
 *   to indicate that the default theme should be used.
......
343 345
    // to perform contextual actions on the help block, and the links needlessly
344 346
    // draw attention on it.
345 347
    if ($key != 'system_main' && $key != 'system_help') {
346
      $build[$key]['#contextual_links']['block'] = array('admin/structure/block/manage', array($block->module, $block->delta));
348
      $build[$key]['#contextual_links']['block'] = array(
349
        'admin/structure/block/manage',
350
        array($block->module, $block->delta),
351
      );
347 352
    }
348 353

  
349 354
    $build[$key] += array(
......
386 391
  // Gather the blocks defined by modules.
387 392
  foreach (module_implements('block_info') as $module) {
388 393
    $module_blocks = module_invoke($module, 'block_info');
394
    $delta_list = array();
389 395
    foreach ($module_blocks as $delta => $block) {
390 396
      // Compile a condition to retrieve this block from the database.
391
      $condition = db_and()
392
        ->condition('module', $module)
393
        ->condition('delta', $delta);
394
      $or->condition($condition);
395 397
      // Add identifiers.
398
      $delta_list[] = $delta;
396 399
      $block['module'] = $module;
397
      $block['delta']  = $delta;
398
      $block['theme']  = $theme;
400
      $block['delta'] = $delta;
401
      $block['theme'] = $theme;
399 402
      $current_blocks[$module][$delta] = $block;
400 403
    }
404
    if (!empty($delta_list)) {
405
      $condition = db_and()->condition('module', $module)->condition('delta', $delta_list);
406
      $or->condition($condition);
407
    }
401 408
  }
402 409
  // Save the blocks defined in code for alter context.
403 410
  $code_blocks = $current_blocks;
......
644 651
    $regions = system_region_list($theme, REGIONS_VISIBLE);
645 652
    $result = db_query("SELECT * FROM {block} WHERE theme = :theme", array(':theme' => $default_theme), array('fetch' => PDO::FETCH_ASSOC));
646 653
    foreach ($result as $block) {
647
      // If the region isn't supported by the theme, assign the block to the theme's default region.
654
      // If the region isn't supported by the theme, assign the block to the
655
      // theme's default region.
648 656
      if ($block['status'] && !isset($regions[$block['region']])) {
649 657
        $block['region'] = system_default_region($theme);
650 658
      }
......
812 820
      // with different case. Ex: /Page, /page, /PAGE.
813 821
      $pages = drupal_strtolower($block->pages);
814 822
      if ($block->visibility < BLOCK_VISIBILITY_PHP) {
815
        // Convert the Drupal path to lowercase
823
        // Convert the Drupal path to lowercase.
816 824
        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
817 825
        // Compare the lowercase internal and lowercase path alias (if any).
818 826
        $page_match = drupal_match_path($path, $pages);
819 827
        if ($path != $_GET['q']) {
820 828
          $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
821 829
        }
822
        // When $block->visibility has a value of 0 (BLOCK_VISIBILITY_NOTLISTED),
823
        // the block is displayed on all pages except those listed in $block->pages.
824
        // When set to 1 (BLOCK_VISIBILITY_LISTED), it is displayed only on those
825
        // pages listed in $block->pages.
830
        // When $block->visibility has a value of 0
831
        // (BLOCK_VISIBILITY_NOTLISTED), the block is displayed on all pages
832
        // except those listed in $block->pages. When set to 1
833
        // (BLOCK_VISIBILITY_LISTED), it is displayed only on those pages
834
        // listed in $block->pages.
826 835
        $page_match = !($block->visibility xor $page_match);
827 836
      }
828 837
      elseif (module_exists('php')) {
......
845 854
 * Render the content and subject for a set of blocks.
846 855
 *
847 856
 * @param $region_blocks
848
 *   An array of block objects such as returned for one region by _block_load_blocks().
857
 *   An array of block objects such as returned for one region by
858
 *   _block_load_blocks().
849 859
 *
850 860
 * @return
851 861
 *   An array of visible blocks as expected by drupal_render().
......
953 963
 * Theme and language contexts are automatically differentiated.
954 964
 *
955 965
 * @param $block
966
 *   The block to get the cache_id from.
967
 *
956 968
 * @return
957 969
 *   The string used as cache_id for the block.
958 970
 */

Formats disponibles : Unified diff