diff --git a/README.txt b/README.txt index a71dfdc..21bd5a0 100644 --- a/README.txt +++ b/README.txt @@ -12,8 +12,7 @@ Taxonomy module (Drupal core) needs to be enabled. -- INSTALLATION -- -* Install as usual, see http://drupal.org/documentation/install/modules-themes/modules-7 - for further information. +* Install as usual, see [1] for further information. -- CONFIGURATION -- @@ -53,3 +52,5 @@ This project has been sponsored by: Drupal experts providing professional Drupal development services. Visit http://www.undpaul.de for more information. + +[1] http://drupal.org/documentation/install/modules-themes/modules-7 diff --git a/includes/handlers/shs_handler_filter_term_node_tid.inc b/includes/handlers/shs_handler_filter_term_node_tid.inc index f0b03aa..9f42fae 100644 --- a/includes/handlers/shs_handler_filter_term_node_tid.inc +++ b/includes/handlers/shs_handler_filter_term_node_tid.inc @@ -35,7 +35,8 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one return TRUE; } - function get_value_options() { /* don't overwrite the value options */ + function get_value_options() { + // Don't overwrite the value options. } function option_definition() { @@ -78,7 +79,11 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one $form['type'] = array( '#type' => 'radios', '#title' => t('Selection type'), - '#options' => array('shs' => t('Simple hierarchical select'), 'select' => t('Dropdown'), 'textfield' => t('Autocomplete')), + '#options' => array( + 'shs' => t('Simple hierarchical select'), + 'select' => t('Dropdown'), + 'textfield' => t('Autocomplete') + ), '#default_value' => $this->options['type'], ); @@ -227,8 +232,8 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one $keys = array_keys($options); $default_value = array_shift($keys); } - // Due to #1464174 there is a chance that array('') was saved in the admin ui. - // Let's choose a safe default value. + // Due to #1464174 there is a chance that array('') was saved in the + // admin ui. Let's choose a safe default value. elseif ($default_value == array('')) { $default_value = 'All'; } @@ -252,9 +257,8 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one } } - if (empty($form_state['exposed'])) { - // Retain the helper option + // Retain the helper option. $this->helper->options_form($form, $form_state); } } @@ -279,7 +283,7 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one } // If view is an attachment and is inheriting exposed filters, then assume - // exposed input has already been validated + // exposed input has already been validated. if (!empty($this->view->is_attachment) && $this->view->display_handler->uses_exposed()) { $this->validated_exposed_input = (array) $this->view->exposed_raw_input[$this->options['expose']['identifier']]; } @@ -332,9 +336,9 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one * or the exposed filter, this is abstracted out a bit so it can * handle the multiple input sources. * - * @param $form + * @param array $form * The form which is used, either the views ui or the exposed filters. - * @param $values + * @param array $values * The taxonomy names which will be converted to tids. * * @return array @@ -380,7 +384,7 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one } function value_submit($form, &$form_state) { - // prevent array_filter from messing up our arrays in parent submit. + // Prevent array_filter from messing up our arrays in parent submit. } function expose_form(&$form, &$form_state) { @@ -396,7 +400,7 @@ class shs_handler_filter_term_node_tid extends views_handler_filter_many_to_one } function admin_summary() { - // set up $this->value_options for the parent summary + // Set up $this->value_options for the parent summary. $this->value_options = array(); if ($this->value) { diff --git a/js/shs.js b/js/shs.js index 8afc5f3..ba8c9c8 100644 --- a/js/shs.js +++ b/js/shs.js @@ -295,7 +295,8 @@ .bind('change', function() { updateElements($(this), base_id, settings, level); }) - .hide(); // Initially hide the element. + // Initially hide the element. + .hide(); // Return the new element. return $element; } diff --git a/shs.module b/shs.module index d3edd33..541c5d8 100644 --- a/shs.module +++ b/shs.module @@ -54,7 +54,7 @@ function shs_json() { /** * Get a list of supported JSON callbacks. * - * @return + * @return array * List of valid callbacks with the following structure: * - [name of callback] * - 'arguments' @@ -85,12 +85,12 @@ function shs_json_callbacks() { /** * Helper function to get the (validated) arguments for a JSON callback. * - * @param $callback - * Callback definition from campus_events_json_callbacks(). - * @param $arguments + * @param array $callback + * Callback definition from shs_json_callbacks(). + * @param array $arguments * Unfiltered arguments posted with $.ajax(). * - * @return + * @return array * List of (validated) arguments for this callback. Any arguments not defined * for this callback will be removed. */ @@ -144,7 +144,7 @@ function shs_field_widget_info() { 'create_new_terms' => FALSE, 'create_new_levels' => FALSE, 'force_deepest' => FALSE, - ) + ), ), ), ); @@ -274,7 +274,8 @@ function shs_field_widget_form(&$form, &$form_state, $field, $instance, $langcod '#attributes' => array( 'class' => array('shs-enabled'), ), - '#maxlength' => NULL, // Prevent errors with drupal_strlen(). + // Prevent errors with drupal_strlen(). + '#maxlength' => NULL, '#element_validate' => array('shs_field_widget_validate'), ); @@ -439,16 +440,16 @@ function shs_field_formatter_view($entity_type, $entity, $field, $instance, $lan * ), * * - * @param $vid + * @param int $vid * ID of vocabulary the term is associated to. - * @param $parent + * @param int $parent * ID of parent term. - * @param $settings + * @param array $settings * Additional settings (for example "display node count"). - * @param $reset + * @param boolean $reset * If TRUE, rebuild the cache for the given $vid and $parent. * - * @return + * @return array * List of child terms keyed by term id. */ function shs_term_get_children($vid, $parent = 0, $settings = array(), $reset = FALSE) { @@ -502,14 +503,14 @@ function shs_term_get_children($vid, $parent = 0, $settings = array(), $reset = /** * Adds a term with ajax. * - * @param $vid + * @param int $vid * ID of vocabulary to create the term in. - * @param $parent + * @param int $parent * ID of parent term (0 for top level). - * @param $term_name + * @param string $term_name * Name of new term. * - * @return + * @return mixed * Array with tid and name or FALSE on error. */ function shs_json_term_add($vid, $parent, $term_name) { @@ -519,9 +520,9 @@ function shs_json_term_add($vid, $parent, $term_name) { } $term = (object) array( - 'vid' => $vid, - 'parent' => $parent, - 'name' => check_plain(filter_xss($term_name)), + 'vid' => $vid, + 'parent' => $parent, + 'name' => check_plain(filter_xss($term_name)), ); // Save term. $status = taxonomy_term_save($term); @@ -581,12 +582,12 @@ function shs_form_taxonomy_form_term_submit(&$form, &$form_state) { /** * Helper function to get all instances of widgets with type "taxonomy_shs". * - * @param $entity_type + * @param string $entity_type * Name of entity type. - * @param $bundle + * @param string $bundle * Name of bundle (optional). * - * @return + * @return array * List of instances keyed by field name. */ function _shs_get_instances($entity_type, $bundle = NULL) { @@ -615,12 +616,12 @@ function _shs_get_instances($entity_type, $bundle = NULL) { /** * Helper function to count number of nodes associated to a term. * - * @param $term + * @param object $term * The term object. - * @param $count_children + * @param boolean $count_children * If set to TRUE, nodes in child terms are counted also. * - * @return + * @return int * Number of nodes within the term. */ function _shs_term_get_node_count($term, $count_children = FALSE) {