--- /Users/neyoung/Desktop/autotag/autotag.module +++ autotag.module @@ -89,6 +89,38 @@ } } + +/** + * Implementation of hook_admin() + * + * Used to create the settings page + */ +function autotag_admin() { + + $form['autotag_fields'] = array( + '#type' => 'textfield', + '#title' => t('Fields to ignore'), + '#default_value' => variable_get('autotag_fields', ''), + '#size' => 80, + '#maxlength' => 256, + '#description' => t("Comma separated list of fields to ignore."), + '#required' => FALSE, + ); + + $form['autotag_content_types'] = array( + '#type' => 'textfield', + '#title' => t('Content types to ignore'), + '#default_value' => variable_get('autotag_content_types', ''), + '#size' => 80, + '#maxlength' => 256, + '#description' => t("Comma separated list of content types that autotag won't be applied to."), + '#required' => FALSE, + ); + + return system_settings_form($form); +} + + /** * Implementation of hook_menu * @@ -102,6 +134,16 @@ 'access arguments' => array('create node content'), 'type' => MENU_CALLBACK ); + + $items['admin/autotag/autocomplete'] = array( + 'title' => 'Autotag Configuration', + 'description' => 'Allows you to configure the autotag module', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('autotag_admin'), + 'access arguments' => array('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); + return $items; } @@ -180,6 +222,9 @@ // Autotag doesn't work with the following content types, return if this node // is one of these. $node_types_to_ignore = variable_get("autotag_borked_content_types", variable_get('autotag_broken_node_types', array('webform', 'biblio'))); + + $node_types_to_ignore = array_merge($node_types_to_ignore, explode(', ', trim(variable_get('autotag_content_types', '')))); + if(in_array($form['type']['#value'], $node_types_to_ignore)){return;} // We're here, the form needs some changes, so lets get to it. @@ -650,6 +695,9 @@ $ignore_fields = array( 'op','attach-url','nid','vid','status','type','created','comment','changed','promote','sticky','revision_timestamp','log','format','uid','name','picture','data','path','last_comment_timestamp','last_comment_name','comment_count','files','iid','taxonomy','readmore','content','links','additionaltags' ); + + $ignore_fields = array_merge($ignore_fields, explode(', ', trim(variable_get('autotag_fields', '--TEST2--')))); + foreach($node as $key=>$value){ if(!in_array($key, $ignore_fields)){ $fields[] = $key; @@ -662,6 +710,9 @@ $ignore_fields = array( 'op','attach-url','nid','vid','status','type','created','comment','changed','promote','sticky','revision_timestamp','log','format','uid','name','picture','data','path','last_comment_timestamp','last_comment_name','comment_count','files','iid','taxonomy','readmore','content','links','additionaltags' ); + + $ignore_fields = array_merge($ignore_fields, explode(', ', trim(variable_get('autotag_fields', '--TEST2--')))); + if(is_object($post_form) || is_array($post_form)){ foreach($post_form as $key=>$value){ if(!in_array($key, $ignore_fields)){