jlaundre's blog

Using Display Suite to add a link to a field.

The DOI field in Data Set content is a text field not a link field type.  With Dispaly Suite Fields one can add a code field that will linked the DOI to doi.org.

The trick here is to use tokens to display the DOI and to link to.

So: Administration -> Structure -> Display Suite-> Fields and Add a code field. 

Give it a  Label and check Entities-> Node and at the bottom check Tokens

The token for the DOI field is: [node:field_doi].  You can browse the available tokens to find all the available tokens.

Disabling the increase of revision number when a data set is saved.

  • The update of the revision number when data sets are saved was not useful since the number can get out of hand when doing multiple saves.  In the eml module the lib/EmlDataSet.php have a funtion to update the revision.  I modified as such:

   public function incrementEMLRevisionID() {
     $revision_id = $this->getEMLRevisionID();
-    if (!empty($revision_id)) {
-      $revision_id++;
-    }
-    else {
-      $revision_id = 1;

Re-populating the cache_lter_unit table

Somehow the cache for lter_ units in my site was empty.  In looking at the MySQL database units-option:en and units:scope=2 were empty arrays.  This cache is created from the deims custom module lter_unit. Specifically in the lib/LterUnitHelper.php

This a drupal_static(__FUNCTION__) .  There is not a way for the cache to expire and get reloaded.  I add the following code to check if the cache data is empty and reload the database if it is.

      $cache = cache_get($cid, 'cache_lter_unit');
      if (!empty($cache->data)

Invalid date range upon saving content

I was getting an error when saving a Data Source Content type with a large number of variables.  Date invalid fromat.

In syslog there was a message: apache2: PHP Warning:  Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. 

After seaarching I found: https://2bits.com/drupal/drupal-not-saving-admin-pages-large-number-inpu...

Configuring PHP to accept more input variables

Adding File hash and number of records to DEMIS EML

Number of Records

A field for Number of Records for a comma delimited data file was not included in the DEIMS 7.  I added it to the Data Source content type as an integer  with a name of 'Number of records' (machine name - field_number_of_records). (Side Note: I actually added the hash output first. After staring at the code for so long I decided to add this also.)


Subscribe to RSS - jlaundre's blog