Projet

Général

Profil

Révision e4c061ad

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/panels/panels.module
6 6
 * Core functionality for the Panels engine.
7 7
 */
8 8

  
9
define('PANELS_REQUIRED_CTOOLS_API', '2.0-alpha');
9
define('PANELS_REQUIRED_CTOOLS_API', '2.0.8');
10

  
11
/**
12
 * The current working panels version.
13
 *
14
 * In a release, it should be 7.x-3.x, which should match what drush make will
15
 * create. In a dev format, it should be 7.x-3.(x+1)-dev, which will allow
16
 * modules depending on new features in panels to depend on panels > 7.x-3.x.
17
 *
18
 * To define a specific version of Panels as a dependency for another module,
19
 * simply include a dependency line in that module's info file, e.g.:
20
 *   ; Requires Panels v7.x-3.4 or newer.
21
 *   dependencies[] = panels (>=3.4)
22
 */
23
define('PANELS_VERSION', '7.x-3.5');
24

  
10 25

  
11 26
define('PANELS_TITLE_FIXED', 0); // Hide title use to be true/false. So false remains old behavior.
12 27
define('PANELS_TITLE_NONE', 1); // And true meant no title.
......
43 58
    'variables' => array('id' => NULL, 'image' => NULL, 'title' => NULL),
44 59
  );
45 60
  $theme['panels_pane'] = array(
46
    'variables' => array('output' => array(), 'pane' => array(), 'display' => array()),
61
    'variables' => array('content' => array(), 'pane' => array(), 'display' => array()),
47 62
    'path' => drupal_get_path('module', 'panels') . '/templates',
48 63
    'template' => 'panels-pane',
49 64
  );
......
269 284
  return array(
270 285
    'use panels dashboard' => array(
271 286
      'title' => t("Use Panels Dashboard"),
272
      'description' => t("Allows a user to access the !link.", array('!link' => l('Panels Dashboard', 'admin/structure/panels'))),
287
      'description' => t('Allows a user to access the <a href="@url">Panels Dashboard</a>.', array('@url' => url('admin/structure/panels'))),
273 288
    ),
274 289
    'view pane admin links' => array( // @todo
275 290
      'title' => t("View administrative links on Panel panes"),
......
329 344
 * Implements hook_flush_caches().
330 345
 */
331 346
function panels_flush_caches() {
332
  return array('cache_panels');
347
  if (db_table_exists('cache_panels')) {
348
    return array('cache_panels');
349
  }
333 350
}
334 351

  
335 352
// ---------------------------------------------------------------------------
......
786 803
    $content_subtype = ctools_content_get_subtype($content_type, $subtype);
787 804
    $pane->configuration = ctools_content_get_defaults($content_type, $content_subtype);
788 805
  }
806
  drupal_alter('panels_new_pane', $pane);
789 807

  
790 808
  return $pane;
791 809
}
......
1316 1334
  $vars['pane_suffix'] = !empty($content->pane_suffix) ? $content->pane_suffix : '';
1317 1335

  
1318 1336
  $vars['title'] = !empty($content->title) ? $content->title : '';
1337
  $vars['title_heading'] = !empty($content->title_heading) ? $content->title_heading : 'h2';
1319 1338
  $vars['title_attributes_array']['class'][] = 'pane-title';
1320 1339

  
1321 1340
  $vars['feeds'] = !empty($content->feeds) ? implode(' ', $content->feeds) : '';
......
1772 1791
  return empty($layout['builder']);
1773 1792
}
1774 1793

  
1794
/**
1795
 * Implements hook_get_pane_links_alter().
1796
 *
1797
 * add links to the Panels pane dropdown menu.
1798
 */
1799
function panels_get_pane_links_alter(&$links, $pane, $content_type) {
1800
  if ($pane->type === "block"){
1801
    $prefixed_name = $pane->subtype;
1802

  
1803
    // breakup the subtype string into parts.
1804
    $exploded_subtype = explode('-', $pane->subtype);
1805

  
1806
    // get the first part of the string.
1807
    $subtype_prefix = $exploded_subtype[0];
1808

  
1809
    // get the first part of the string and add a hyphen.
1810
    $subtype_prefix_hyphen = $exploded_subtype[0] . '-';
1811

  
1812
    // remove the prefix block- to get the name.
1813
    $name_of_block = ltrim( $prefixed_name, $subtype_prefix_hyphen);
1814

  
1815
    // check for user added menus created at /admin/structure/menu/add
1816
    // menus of that type have a subtype that is prefixed with menu-menu-
1817
    if (substr($prefixed_name, 0, 10) === "menu-menu-"){
1818
      // remove the first prefix menu- from menu-menu- to get the name.
1819
      $name_of_block = substr($prefixed_name, 5);
1820

  
1821
      $links['top'][] = array(
1822
        'title' => t('Edit block'),
1823
        'href' => url('admin/structure/block/manage/' . $subtype_prefix . '/' . $name_of_block . '/configure', array('absolute' => TRUE)),
1824
        'attributes' => array('target' => array('_blank')),
1825
      );
1826

  
1827
      $links['top'][] = array(
1828
        'title' => t('Edit menu links'),
1829
        'href' => url('admin/structure/menu/manage/' . $name_of_block, array('absolute' => TRUE)),
1830
        'attributes' => array('target' => array('_blank')),
1831
      );
1832
    }
1833

  
1834
    // check for module provided menu blocks like Devels or Features
1835
    // menus of that type have a subtype that is prefixed with menu-
1836
    elseif(substr($prefixed_name, 0, 5) === "menu-"){
1837
      // remove the first prefix menu- to get the name.
1838
      $name_of_block = substr($prefixed_name, 5);
1839

  
1840
      $links['top'][] = array(
1841
        'title' => t('Edit block'),
1842
        'href' => url('admin/structure/block/manage/' . $subtype_prefix . '/' . $name_of_block . '/configure', array('absolute' => TRUE)),
1843
        'attributes' => array('target' => array('_blank')),
1844
      );
1845

  
1846
      $links['top'][] = array(
1847
        'title' => t('Edit menu links'),
1848
        'href' => url('admin/structure/menu/manage/' . $name_of_block, array('absolute' => TRUE)),
1849
        'attributes' => array('target' => array('_blank')),
1850
      );
1851
    }
1852

  
1853
    // check for system blocks with menu links
1854
    elseif(substr($prefixed_name, 0, 7) === "system-") {
1855
      // remove the first prefix system- to get the name
1856
      $name_of_block = substr($prefixed_name, 7);
1857

  
1858
      $names_of_system_menus = menu_list_system_menus();
1859

  
1860
      $links['top'][] = array(
1861
        'title' => t('Edit block'),
1862
        'href' => url('admin/structure/block/manage/' . $subtype_prefix . '/' . $name_of_block . '/configure', array('absolute' => TRUE)),
1863
        'attributes' => array('target' => array('_blank')),
1864
      );
1865

  
1866
      if (array_key_exists($name_of_block, $names_of_system_menus)){
1867
        $links['top'][] = array(
1868
          'title' => t('Edit menu links'),
1869
          'href' => url('admin/structure/menu/manage/' . $name_of_block, array('absolute' => TRUE)),
1870
          'attributes' => array('target' => array('_blank')),
1871
        );
1872
      }
1873
    }
1874

  
1875
    // for all other blocks without menus
1876
    else{
1877
      $links['top'][] = array(
1878
        'title' => t('Edit block'),
1879
        'href' => url('admin/structure/block/manage/' . $subtype_prefix . '/' . $name_of_block . '/configure', array('absolute' => TRUE)),
1880
        'attributes' => array('target' => array('_blank')),
1881
      );
1882
    }
1883
  }
1884
}
1885

  
1775 1886
// --------------------------------------------------------------------------
1776 1887
// Deprecated functions
1777 1888
//
......
1791 1902
function panels_preprocess_html(&$vars) {
1792 1903
  $panel_body_css = &drupal_static('panel_body_css');
1793 1904
  if (!empty($panel_body_css['body_classes_to_remove'])) {
1794
    $classes_to_remove = explode(' ', $panel_body_css['body_classes_to_remove']);
1905
    $classes_to_remove = array_filter(explode(' ', $panel_body_css['body_classes_to_remove']), 'strlen');
1795 1906
    foreach ($vars['classes_array'] as $key => $css_class) {
1796 1907
      if (in_array($css_class, $classes_to_remove)) {
1797 1908
        unset($vars['classes_array'][$key]);

Formats disponibles : Unified diff