Project

General

Profile

« Previous | Next » 

Revision c05d1cfb

Added by Andreas Kohlbecker almost 5 years ago

fix #8388 block to search UTIS implemented

View differences:

modules/cdm_dataportal/cdm_dataportal.module
331 331
    );
332 332
  }
333 333

  
334

  
335
function _add_js_utis_client($jquery_selector){
336

  
337
  drupal_add_js(drupal_get_path('module',
338
      'cdm_dataportal') . '/js/utis-client/utis-client.js',
339
    array(
340
      'type' => 'file',
341
      'weight' => JS_LIBRARY,
342
      'cache' => TRUE,
343
      'preprocess' => FALSE
344
    )
345
  );
346

  
347
  drupal_add_js('jQuery(document).ready(function() {
348
        jQuery( "' . $jquery_selector . '" ).utis_client(
349
        {
350
          spinnerIcon: \'' . font_awesome_icon_markup('fa-sync', array('class' => array('fa-3x',  'fas fa-spin'), 'style' => array('opacity: 0.3;'))) . '\'
351
        });
352
      });',
353
    array('type' => 'inline')
354
  );
355
}
356

  
334 357
  /**
335 358
   * Provides the markup for an font awesome icon.
336 359
   *
......
838 861
    'visibility' => BLOCK_VISIBILITY_NOTLISTED,
839 862
    'pages' => "cdm_dataportal/registration-search\ncdm_dataportal/registration-search/*", // multiple page paths separated by "\n"!!!
840 863
  );
864
  $block['utis_search'] =  array(
865
    'title' => 'UTIS Search',
866
    'info' => t('Query the Unified Taxonomic Information Service (UTIS)' ),
867
    'cache' => DRUPAL_CACHE_PER_PAGE,
868
    'visibility' => BLOCK_VISIBILITY_NOTLISTED
869
  );
841 870
  return $block;
842 871
}
843 872

  
......
930 959
        )
931 960
    );
932 961
       return $block;
962
    case 'utis_search':
963
      _add_js_utis_client('.utis_client');
964
      $block['subject'] = '<none>';
965
      $block['content'] = '<div class="utis_client"/>';
966
      return $block;
933 967
    default:
934 968
      return null;
935 969
  }

Also available in: Unified diff