Project

General

Profile

« Previous | Next » 

Revision 89aa0117

Added by Andreas Kohlbecker about 3 years ago

ref #9659 field 'glue' removed from admin pages

View differences:

modules/cdm_dataportal/ext_links/ext_links.admin.inc
20 20
  foreach ($link_templates as $id => $link_template) {
21 21
    $form['link_templates'][$id]['title'] = array('#markup' => check_plain($link_template->title));
22 22
    $form['link_templates'][$id]['link'] = array('#markup' => check_plain($link_template->link));
23
    $form['link_templates'][$id]['glue'] = array('#markup' => check_plain($link_template->glue));
24 23
    $form['link_templates'][$id]['category'] = array('#markup' => check_plain($link_template->category));
25 24
    $form['link_templates'][$id]['configure'] = array('#type' => 'link', '#title' => t('configure'), '#href' => 'admin/config/cdm_dataportal/ext_links/' . $link_template->id);
26 25
    $form['link_templates'][$id]['status'] = array('#type' => 'link',
......
66 65
 *   (optional) An object representing an external link template, with the following properties:
67 66
 *   - title: The link title
68 67
 *   - link: The link url template.
69
 *   - glue: The string to concatenate name parts in the URL query string.
70 68
 *   - status: (optional) An integer indicating whether the ext link is
71 69
 *     enabled (1) or not (0). Defaults to 1.
72 70
 *   - weight: (optional) The weight of the external link, which controls its
......
84 82
    $link_template = (object) array(
85 83
      'title' => NULL,
86 84
      'link' => 'https://',
87
      'glue' => '',
88 85
      'weight' => 0,
89 86
      'status' => 1
90 87
    );
......
122 119
 *     updated; otherwise, a new external link will be created.
123 120
 *   - title: The link title
124 121
 *   - link: The link url template.
125
 *   - glue: The string to concatenate name parts in the URL query string.
126 122
 *   - status: (optional) An integer indicating whether the ext link is
127 123
 *     enabled (1) or not (0). Defaults to 1.
128 124
 *   - weight: (optional) The weight of the external link, which controls its
......
155 151
    '#description' => t('The text of the link that will be displayed.'),
156 152
    '#required' => TRUE,
157 153
  );
154
  $token_info = cdm_tokens_token_info();
155
  $cdm_tokens = [];
156
  foreach(array_keys($token_info['tokens']['cdm']) as $token_key){
157
    $cdm_tokens[] = '[cdm:' . $token_key . ']';
158
  }
158 159
  $form['link'] = array(
159 160
    '#type' => 'textfield',
160 161
    '#title' => t('Link'),
161
    '#description' => t('The URL of the link to the external resource or service. 
162
    The species name parts will be appended to this string.<p>E.g. 
163
    <code>https://external-service.test/images?q=</code> will result in 
164
    <code>https://external-service.test/images?q=Bellis+perennis</code> when the glue string is set to "+"</p>'),
162
    '#description' => t('The URL template for the link to the external resource or service.
163
        The following <i>cdm tokens</i> can be used here: <ul> !cdm_tokens </ul>',
164
      ['!cdm_tokens' => '<li><code>' . join('</code></li><li><code>', $cdm_tokens) . '</code></li>']
165
    ),
165 166
    '#default_value' => $link_template->link,
166 167
    '#required' => TRUE,
167 168
  );
168
  $form['glue'] = array(
169
    '#type' => 'textfield',
170
    '#title' => t('Glue'),
171
    '#description' => t('The string used to concatenate genus and species name parts in the query string.'),
172
    '#default_value' => $link_template->glue,
173
    '#required' => false,
174
  );
169

  
175 170
  $form['status'] = array(
176 171
    '#type' => 'checkbox',
177 172
    '#title' => t('Enabled'),
......
256 251
      'data' => array(
257 252
        drupal_render($form['link_templates'][$id]['title']),
258 253
        drupal_render($form['link_templates'][$id]['link']),
259
        drupal_render($form['link_templates'][$id]['glue']),
260 254
        drupal_render($form['link_templates'][$id]['category']),
261 255
        drupal_render($form['link_templates'][$id]['weight']),
262 256
        drupal_render($form['link_templates'][$id]['configure']),
......
265 259
      'class' => $row_class_attributes,
266 260
    );
267 261
  }
268
  $header = array(t('Title'), t('Link'), t('Glue'), t('Category'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2));
262
  $header = array(t('Title'), t('Link'), t('Category'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2));
269 263
  $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'link-templates-order')));
270 264
  $output .= drupal_render_children($form);
271 265

  

Also available in: Unified diff