commit 89aa011776dce71d28ed55e9cc4a9c1e6931cba9
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Mon Jun 14 17:11:46 2021 +0200

    ref #9659 field 'glue' removed from admin pages

diff --git a/modules/cdm_dataportal/ext_links/ext_links.admin.inc b/modules/cdm_dataportal/ext_links/ext_links.admin.inc
index 6a43dcb2..6b9739f3 100644
--- a/modules/cdm_dataportal/ext_links/ext_links.admin.inc
+++ b/modules/cdm_dataportal/ext_links/ext_links.admin.inc
@@ -20,7 +20,6 @@ function ext_links_admin_overview($form) {
   foreach ($link_templates as $id => $link_template) {
     $form['link_templates'][$id]['title'] = array('#markup' => check_plain($link_template->title));
     $form['link_templates'][$id]['link'] = array('#markup' => check_plain($link_template->link));
-    $form['link_templates'][$id]['glue'] = array('#markup' => check_plain($link_template->glue));
     $form['link_templates'][$id]['category'] = array('#markup' => check_plain($link_template->category));
     $form['link_templates'][$id]['configure'] = array('#type' => 'link', '#title' => t('configure'), '#href' => 'admin/config/cdm_dataportal/ext_links/' . $link_template->id);
     $form['link_templates'][$id]['status'] = array('#type' => 'link',
@@ -66,7 +65,6 @@ function ext_links_admin_overview_submit($form, &$form_state) {
  *   (optional) An object representing an external link template, with the following properties:
  *   - title: The link title
  *   - link: The link url template.
- *   - glue: The string to concatenate name parts in the URL query string.
  *   - status: (optional) An integer indicating whether the ext link is
  *     enabled (1) or not (0). Defaults to 1.
  *   - weight: (optional) The weight of the external link, which controls its
@@ -84,7 +82,6 @@ function ext_links_admin_link_template_page($link_template = NULL) {
     $link_template = (object) array(
       'title' => NULL,
       'link' => 'https://',
-      'glue' => '',
       'weight' => 0,
       'status' => 1
     );
@@ -122,7 +119,6 @@ function ext_links_admin_appearance_page(){
  *     updated; otherwise, a new external link will be created.
  *   - title: The link title
  *   - link: The link url template.
- *   - glue: The string to concatenate name parts in the URL query string.
  *   - status: (optional) An integer indicating whether the ext link is
  *     enabled (1) or not (0). Defaults to 1.
  *   - weight: (optional) The weight of the external link, which controls its
@@ -155,23 +151,22 @@ function ext_links_admin_link_template_form($form, &$form_state, $link_template)
     '#description' => t('The text of the link that will be displayed.'),
     '#required' => TRUE,
   );
+  $token_info = cdm_tokens_token_info();
+  $cdm_tokens = [];
+  foreach(array_keys($token_info['tokens']['cdm']) as $token_key){
+    $cdm_tokens[] = '[cdm:' . $token_key . ']';
+  }
   $form['link'] = array(
     '#type' => 'textfield',
     '#title' => t('Link'),
-    '#description' => t('The URL of the link to the external resource or service. 
-    The species name parts will be appended to this string.<p>E.g. 
-    <code>https://external-service.test/images?q=</code> will result in 
-    <code>https://external-service.test/images?q=Bellis+perennis</code> when the glue string is set to "+"</p>'),
+    '#description' => t('The URL template for the link to the external resource or service.
+        The following <i>cdm tokens</i> can be used here: <ul> !cdm_tokens </ul>',
+      ['!cdm_tokens' => '<li><code>' . join('</code></li><li><code>', $cdm_tokens) . '</code></li>']
+    ),
     '#default_value' => $link_template->link,
     '#required' => TRUE,
   );
-  $form['glue'] = array(
-    '#type' => 'textfield',
-    '#title' => t('Glue'),
-    '#description' => t('The string used to concatenate genus and species name parts in the query string.'),
-    '#default_value' => $link_template->glue,
-    '#required' => false,
-  );
+
   $form['status'] = array(
     '#type' => 'checkbox',
     '#title' => t('Enabled'),
@@ -256,7 +251,6 @@ function theme_ext_links_admin_overview($variables) {
       'data' => array(
         drupal_render($form['link_templates'][$id]['title']),
         drupal_render($form['link_templates'][$id]['link']),
-        drupal_render($form['link_templates'][$id]['glue']),
         drupal_render($form['link_templates'][$id]['category']),
         drupal_render($form['link_templates'][$id]['weight']),
         drupal_render($form['link_templates'][$id]['configure']),
@@ -265,7 +259,7 @@ function theme_ext_links_admin_overview($variables) {
       'class' => $row_class_attributes,
     );
   }
-  $header = array(t('Title'), t('Link'), t('Glue'), t('Category'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2));
+  $header = array(t('Title'), t('Link'), t('Category'), t('Weight'), array('data' => t('Operations'), 'colspan' => 2));
   $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'link-templates-order')));
   $output .= drupal_render_children($form);
 
diff --git a/modules/cdm_dataportal/ext_links/ext_links.install b/modules/cdm_dataportal/ext_links/ext_links.install
index 1ff7481b..93a5187a 100644
--- a/modules/cdm_dataportal/ext_links/ext_links.install
+++ b/modules/cdm_dataportal/ext_links/ext_links.install
@@ -31,16 +31,9 @@ function ext_links_schema() {
         'not null' => TRUE,
         'description' => 'The link url template',
       ],
-      'glue' => [
-        'type' => 'varchar',
-        'length' => 10,
-        'not null' => TRUE,
-        'description' => 'The string to concatenate name parts in the URL query string',
-      ],
       'category' => [
         'type' => 'varchar',
         'length' => 255,
-        'not null' => TRUE,
         'description' => 'The link category',
       ],
       'weight' => [
@@ -162,7 +155,6 @@ function _ext_links_merge_old_vars($ext_link){
   $ext_link_id = $ext_link->id;
   $ext_link->status = variable_get("ext_links_${ext_link_id}_check", $ext_link->status);
   $ext_link->link =  variable_get("ext_links_${ext_link_id}_link", $ext_link->link);
-  $ext_link->glue = variable_get("ext_links_${ext_link_id}_concat",   $ext_link->glue);
   $ext_link->title = variable_get("ext_links_${ext_link_id}_text", $ext_link->title);
   return $ext_link;
 }
\ No newline at end of file
diff --git a/modules/cdm_dataportal/ext_links/ext_links.module b/modules/cdm_dataportal/ext_links/ext_links.module
index 59fd2a0c..a6176054 100644
--- a/modules/cdm_dataportal/ext_links/ext_links.module
+++ b/modules/cdm_dataportal/ext_links/ext_links.module
@@ -207,7 +207,6 @@ function ext_links_load($extlink_id) {
  *     otherwise, a new external link will be created.
  *   - title: The link title
  *   - link: The link url template.
- *   - glue: The string to concatenate name parts in the URL query string.
  *   - status: (optional) An integer indicating whether the ext link is
  *     enabled (1) or not (0). Defaults to 1.
  *   - weight: (optional) The weight of the external link, which controls its
@@ -235,7 +234,6 @@ function ext_links_save($link_template) {
       'id' => $link_template->id,
       'title' => $link_template->title,
       'link' => $link_template->link,
-      'glue' => $link_template->glue,
       'status' => (int) $link_template->status,
       'weight' => (int) $link_template->weight,
     ))
@@ -294,6 +292,8 @@ function ext_link_species_name($taxon) {
 function ext_links_block_info() {
   if (TRUE) {
     $block[0]["info"] = t("CDM - External Links");
+    $block[0]["visibility"] = BLOCK_VISIBILITY_LISTED;
+    $block[0]["pages"] = "cdm_dataportal/taxon/*\ncdm_dataportal/name/*";
     return $block;
   }
 }
