Skip to content

Commit

Permalink
Code formatting cleanup and README update.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugfolder committed Jul 13, 2023
1 parent bdd7b16 commit e4dce06
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 37 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,13 @@ filter them by a view or limit the number of selectable options with JavaScript.
It's a good idea to turn on the "leaves only" option in this case, as it will
make it look nicer.

Documentation
-------------

Additional documentation is located in [the
Wiki](https://github.com/backdrop-contrib/term_reference_tree/wiki/Documentation).

Differences from Drupal 7
-------------------------

The Backdrop version of this module has some additional classes applied to the
`<li>` elements of the rendered tree to give more flexibility in theming:
`li` elements of the rendered tree to give more flexibility in theming:

* `<li>` elements have class `has-children` or `no-children`, as applicable.
* `li` elements have class `has-children` or `no-children`, as applicable.

Issues
------
Expand Down
3 changes: 0 additions & 3 deletions term_reference_tree.field.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function term_reference_tree_field_formatter_info() {
);
}


/**
* Implements hook_field_formatter_view().
*/
Expand All @@ -39,7 +38,6 @@ function term_reference_tree_field_formatter_view($entity_type, $entity, $field,
return $element;
}


/**
* Implements hook_field_formatter_settings_form().
*/
Expand Down Expand Up @@ -72,7 +70,6 @@ function term_reference_tree_field_formatter_settings_form($field, $instance, $v
return $element;
}


/**
* Implements hook_field_formatter_settings_summary().
*/
Expand Down
16 changes: 6 additions & 10 deletions term_reference_tree.module
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?php
/**
* @file
*
* Main file implementing hooks and callbacks.
*/

module_load_include('inc', 'term_reference_tree', 'term_reference_tree.field');
module_load_include('inc', 'term_reference_tree', 'term_reference_tree.widget');

Expand Down Expand Up @@ -38,7 +44,6 @@ function term_reference_tree_element_info() {
return $types;
}


/**
* Implements hook_theme().
*/
Expand All @@ -65,7 +70,6 @@ function term_reference_tree_theme() {
);
}


/**
* Return a taxonomy term hierarchy in a nested array.
*
Expand Down Expand Up @@ -94,7 +98,6 @@ function _term_reference_tree_get_term_hierarchy($tid, $vocabulary_name, $allowe
return _term_reference_tree_get_term_hierarchy_recursive($tid, $tree, $expanded, $use_ajax, $max_depth);
}


/**
* Recursive helper function for _term_reference_tree_get_term_hierarchy().
*/
Expand Down Expand Up @@ -123,7 +126,6 @@ function _term_reference_tree_get_term_hierarchy_recursive($parent_tid, $tree, $
return $terms;
}


/**
* Get all terms and their parent and children hierarchy for a given vocabulary_name.
*
Expand Down Expand Up @@ -162,7 +164,6 @@ function _term_reference_tree_taxonomy_get_tree($vocabulary_name) {
return $tree[$vocabulary_name];
}


/**
* Get all parent tids for a given vocabulary_name and children tids.
*
Expand All @@ -179,7 +180,6 @@ function _term_reference_tree_taxonomy_term_load_parents_all($vocabulary_name, $
return _term_reference_tree_taxonomy_term_load_parents_all_recursive($vocabulary_name, $children_tids, $tree);
}


/**
* Helper function for _term_reference_tree_taxonomy_term_load_parents_all().
*/
Expand All @@ -196,7 +196,6 @@ function _term_reference_tree_taxonomy_term_load_parents_all_recursive($vocabula
return $parents;
}


/**
* Resolve the label to use in the widget for the given taxonomy terms.
*
Expand Down Expand Up @@ -225,7 +224,6 @@ function _term_reference_tree_taxonomy_resolve_labels($terms, $token_display) {
}
}


/**
* Flatten the tree hierarchy.
*/
Expand All @@ -241,7 +239,6 @@ function _term_reference_tree_hierarchy_flatten($terms_hierarchy) {
return $terms;
}


/**
* Get the parent tid of a taxonomy terms.
*/
Expand All @@ -260,7 +257,6 @@ function _term_reference_tree_get_parent($tid) {
return $t;
}


/**
* Recursively go through the option tree and return a flat array of options.
*/
Expand Down
16 changes: 0 additions & 16 deletions term_reference_tree.widget.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function term_reference_tree_field_widget_info() {
);
}


/**
* Implements hook_field_widget_settings_form().
*/
Expand Down Expand Up @@ -157,7 +156,6 @@ function term_reference_tree_field_widget_settings_form($field, $instance) {
return $form;
}


/**
* Theme the term tree display (as opposed to the select widget).
*/
Expand Down Expand Up @@ -205,7 +203,6 @@ function theme_term_tree_list($variables) {
return $output;
}


/**
* Helper function to output a single level of the term reference tree display.
*/
Expand Down Expand Up @@ -251,7 +248,6 @@ function _term_reference_tree_output_list_level(&$element, &$tree) {
}
}


/**
* Make sure that cardinality is unlimited if auto-select parents is enabled.
*/
Expand All @@ -263,7 +259,6 @@ function _term_reference_tree_select_parents_validate($element, &$form_state) {
}
}


/**
* Make sure that cardinality is unlimited if cascading selection is enabled.
*/
Expand All @@ -280,7 +275,6 @@ function _term_reference_tree_cascading_selection_validate($element, &$form_stat
}
}


/**
* Process the checkbox_tree widget.
*
Expand Down Expand Up @@ -355,7 +349,6 @@ function term_reference_tree_process_checkbox_tree($element, $form_state) {
return $element;
}


/**
* Returns HTML for a checkbox_tree form element.
*
Expand Down Expand Up @@ -403,7 +396,6 @@ function theme_checkbox_tree($variables) {
. '</div>';
}


/**
* Print a list item with a checkbox and an unordered list of all the elements
* inside it.
Expand Down Expand Up @@ -443,7 +435,6 @@ function theme_checkbox_tree_level($variables) {
return $output;
}


/**
* Print a single item in the tree, followed by that item's children (which may
* be another checkbox_tree_level).
Expand Down Expand Up @@ -473,7 +464,6 @@ function theme_checkbox_tree_item($variables) {
return $output;
}


/**
* Print a label that cannot be selected.
*/
Expand Down Expand Up @@ -520,7 +510,6 @@ function theme_checkbox_tree_track_list($variables) {
return $output;
}


/**
* Implements hook_field_widget_form().
*/
Expand Down Expand Up @@ -584,7 +573,6 @@ function term_reference_tree_field_widget_form(&$form, &$form_state, $field, $in
return $element;
}


/**
* Validate the term reference tree widgets.
*
Expand Down Expand Up @@ -641,7 +629,6 @@ function _term_reference_tree_widget_validate(&$element, &$form_state) {
return $element;
}


/**
* Return an array of allowed values defined by the given view.
*
Expand Down Expand Up @@ -682,7 +669,6 @@ function _term_reference_tree_get_allowed_values($filter) {
return $allowed;
}


/**
* Build a single item in the term reference tree widget.
*
Expand Down Expand Up @@ -772,7 +758,6 @@ function _term_reference_tree_build_item($element, $term, $form_state, $value, $
return $container;
}


/**
* Build a level in the term reference tree widget.
*
Expand Down Expand Up @@ -834,7 +819,6 @@ function _term_reference_tree_build_level($element, $term, $form_state, $value,
return $container;
}


/**
* Ajax callback to load children for a list.
*/
Expand Down

0 comments on commit e4dce06

Please sign in to comment.