Permalink
Browse files

Added bibtex import functionality

  • Loading branch information...
1 parent fe6af54 commit f431045c27a8780fbfb90cb746004efb10f80e8a @ngmaloney ngmaloney committed Aug 17, 2011
View
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * Implements hook_form()
+ * Journalstream admin form
+*/
+function journalstream_admin_form() {
+ $form = array();
+ $content_types = variable_get('journalstream_content_types', _journalstream_get_default_types());
+ $form['journalstream_content_types'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Node Types:'),
+ '#description' => t('Select which node types will be used in a Journalstream feed.'),
+ '#options' => _journalstream_get_node_types(),
+ '#default_value' => $content_types,
+ );
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#name' => 'Submit',
+ '#value' => 'Submit'
+ );
+ return $form;
+}
+
+/**
+ * Implements hook_submit()
+ * Submit handler for admin form
+*/
+function journalstream_admin_form_submit($form, & $form_state) {
+ $vals = array_values($form_state['values']['journalstream_content_types']);
+ $content_types = array();
+ foreach($vals as $key => $val) {
+ if(!empty($val)) {
+ $content_types[] = $val;
+ }
+ }
+ variable_set('journalstream_content_types', $content_types);
+ drupal_set_message('Journalstream content types successfully saved.');
+}
+
+
+
+/**
+ * Helper hook to retrieve a list of node types
+*/
+function _journalstream_get_node_types() {
+ $types = array();
+ $node_types = node_type_get_types();
+ foreach($node_types as $type) {
+ $types[$type->type] = $type->type;
+ }
+ return $types;
+
+ dd(node_type_get_types());
+
+ return array(
+ 'biblio' => 'Biblio',
+ );
+}
View
@@ -38,6 +38,7 @@ features[views_view][] = "journalstream_queue"
files[] = "journalstream.test"
files[] = "styles/biblio_style_journalstream.inc"
files[] = "journalstream.drush.inc"
+files[] = "journalstream.admin.inc"
name = "JournalStream"
package = "SCF"
php = "5.2.4"
Oops, something went wrong.

0 comments on commit f431045

Please sign in to comment.