Created
December 24, 2009 17:27
-
-
Save anarchivist/263276 to your computer and use it in GitHub Desktop.
Use Shrew with Computed Field module in Drupal to store/extract MARC data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* Sample Computed Field/Shrew usage for Drupal. The Shrew module [1] uses the | |
| Shrew [2] PHP library to interact with Innovative Interfaces online library | |
| catalog systems. | |
| [1] http://www.github.com/anarchivist/drupal-shrew | |
| [2] http://www.github.com/anarchivist/shrew | |
| */ | |
| if (!$node->nid) { | |
| node_save($node); | |
| } | |
| $delta = 0; | |
| $node_field = array(); | |
| if ($bnum = $node->field_iii_single[0]['value']) { | |
| $record = shrew_record_get($bnum); | |
| if ($fields = shrew_field_get($record[$bnum]->bibliographicRecord, '520')) { | |
| foreach ($fields as $field) { | |
| $node_field[$delta]['value'] = $field; | |
| $delta++; | |
| } | |
| } | |
| else $node_field[0]['value'] = NULL; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment