Project

General

Profile

« Previous | Next » 

Revision 89aa0117

Added by Andreas Kohlbecker almost 2 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

  
modules/cdm_dataportal/ext_links/ext_links.install
31 31
        'not null' => TRUE,
32 32
        'description' => 'The link url template',
33 33
      ],
34
      'glue' => [
35
        'type' => 'varchar',
36
        'length' => 10,
37
        'not null' => TRUE,
38
        'description' => 'The string to concatenate name parts in the URL query string',
39
      ],
40 34
      'category' => [
41 35
        'type' => 'varchar',
42 36
        'length' => 255,
43
        'not null' => TRUE,
44 37
        'description' => 'The link category',
45 38
      ],
46 39
      'weight' => [
......
162 155
  $ext_link_id = $ext_link->id;
163 156
  $ext_link->status = variable_get("ext_links_${ext_link_id}_check", $ext_link->status);
164 157
  $ext_link->link =  variable_get("ext_links_${ext_link_id}_link", $ext_link->link);
165
  $ext_link->glue = variable_get("ext_links_${ext_link_id}_concat",   $ext_link->glue);
166 158
  $ext_link->title = variable_get("ext_links_${ext_link_id}_text", $ext_link->title);
167 159
  return $ext_link;
168 160
}
modules/cdm_dataportal/ext_links/ext_links.module
207 207
 *     otherwise, a new external link will be created.
208 208
 *   - title: The link title
209 209
 *   - link: The link url template.
210
 *   - glue: The string to concatenate name parts in the URL query string.
211 210
 *   - status: (optional) An integer indicating whether the ext link is
212 211
 *     enabled (1) or not (0). Defaults to 1.
213 212
 *   - weight: (optional) The weight of the external link, which controls its
......
235 234
      'id' => $link_template->id,
236 235
      'title' => $link_template->title,
237 236
      'link' => $link_template->link,
238
      'glue' => $link_template->glue,
239 237
      'status' => (int) $link_template->status,
240 238
      'weight' => (int) $link_template->weight,
241 239
    ))
......
294 292
function ext_links_block_info() {
295 293
  if (TRUE) {
296 294
    $block[0]["info"] = t("CDM - External Links");
295
    $block[0]["visibility"] = BLOCK_VISIBILITY_LISTED;
296
    $block[0]["pages"] = "cdm_dataportal/taxon/*\ncdm_dataportal/name/*";
297 297
    return $block;
298 298
  }
299 299
}

Also available in: Unified diff