Project

General

Profile

« Previous | Next » 

Revision 4feeabc7

Added by Andreas Kohlbecker over 7 years ago

fix #4490 taxon page tab labels configurable and fixing translation issue with menu items

View differences:

modules/cdm_dataportal/settings.php
128 128
  );
129 129
}
130 130

  
131
define('CDM_TAXONPAGE_TAB_WEIGHT', 'cdm_taxonpage_tab_weight');
131 132
define('CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT', serialize(
132 133
  array(
133 134
    'general' => '-3',
......
139 140
    )
140 141
));
141 142

  
143

  
144
// CDM_TAXONPAGE_TAB_LABELS_DEFAULT
145
define('CDM_TAXONPAGE_TAB_LABELS', 'cdm_taxonpage_tab_labels');
146
define('CDM_TAXONPAGE_TAB_LABELS_DEFAULT', serialize(
147
  array(
148
    'general' => null,
149
    'synonymy' => null,
150
    'images' => null,
151
    'specimens' => null,
152
    'keys' => null,
153
    'experts' => null,
154
  )
155
));
156

  
142 157
$taxon_tab_options = get_taxon_tabs_list();
143 158
$taxon_tab_options[CDM_DATAPORTAL_LAST_VISITED_TAB_ARRAY_INDEX] = 'Last visited tab';
144 159

  
......
1820 1835
  );
1821 1836

  
1822 1837
  // WEIGHT
1823
  $taxontabs_weights = get_array_variable_merged('cdm_taxonpage_tabs_weight', CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
1824
  $form['taxon_tabs']['cdm_taxonpage_tabs_weight'] = array(
1825
      '#tree' => true
1838
  $taxon_tabs_weights = get_array_variable_merged(CDM_TAXONPAGE_TAB_WEIGHT, CDM_TAXONPAGE_TAB_WEIGHT_DEFAULT);
1839
  $form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT] = array(
1840
    '#title'  => 'Tabs order',
1841
    '#tree' => true,
1842
    '#description' => 'The weight value defines the order of the tabs or of the respective content block on the 
1843
        taxon page when it is the tabless mode.'
1826 1844
  );
1827 1845
  // Weights range from -delta to +delta, so delta should be at least half
1828 1846
  // of the amount of tabs present.
1829 1847
  $tab_weight_delta = round(count(get_taxon_tabs_list()) / 2) + 1;
1830 1848
  foreach (get_taxon_tabs_list() as $label) {
1831 1849
    $key = strtolower($label); // turn in to string, since we need to use strings as keys
1832
    $form['taxon_tabs']['cdm_taxonpage_tabs_weight'][$key] = array(
1850
    $form['taxon_tabs'][CDM_TAXONPAGE_TAB_WEIGHT][$key] = array(
1833 1851
        '#title' => $label,
1834 1852
        '#type'  => 'weight',
1835
        '#default_value' => $taxontabs_weights[$key],
1853
        '#default_value' => $taxon_tabs_weights[$key],
1836 1854
        '#delta' => $tab_weight_delta
1837 1855
    );
1838 1856
  }
1839 1857

  
1858
  $taxon_tabs_labels = get_array_variable_merged(CDM_TAXONPAGE_TAB_LABELS, CDM_TAXONPAGE_TAB_LABELS_DEFAULT);
1859
  $form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS] = array(
1860
    '#title'  => 'Tab label override',
1861
    '#tree' => true,
1862
    '#description' => 'Setting a label for a tab will override the default label.'
1863
  );
1864
  foreach (get_taxon_tabs_list() as $label) {
1865
    $key = strtolower($label); // turn in to string, since we need to use strings as keys
1866
    $form['taxon_tabs'][CDM_TAXONPAGE_TAB_LABELS][$key] = array(
1867
      '#title' => $label,
1868
      '#type'  => 'textfield',
1869
      '#default_value' => $taxon_tabs_labels[$key]
1870
    );
1871
  }
1872

  
1840 1873
  $form['taxon_tabs']['cdm_dataportal_default_tab'] = array(
1841 1874
    '#type' => 'select',
1842 1875
    '#title' => t('Default tab to display') . ':',

Also available in: Unified diff