You are here

function _taxonomy_publisher_filter_term_list in Taxonomy Tools 7

Same name and namespace in other branches
  1. 8 taxonomy_publisher_filter/taxonomy_publisher_filter.api.inc \_taxonomy_publisher_filter_term_list()

Check if result already cached , if not filter term by term.

Parameters

array $options: array with widget options where tid = array key

bool $cache: use(TRUE) / not (FALSE) cache options

array $settings: if $cache = TRUE settings to create $cache_name

2 calls to _taxonomy_publisher_filter_term_list()
taxonomy_publisher_filter_field_widget_form_alter in taxonomy_publisher_filter/taxonomy_publisher_filter.module
Implements hook_field_widget_form_alter().
_taxonomy_publisher_filter_custom_form in taxonomy_publisher_filter/taxonomy_publisher_filter.api.inc
API function for custom forms.

File

taxonomy_publisher_filter/taxonomy_publisher_filter.api.inc, line 67
API functions.

Code

function _taxonomy_publisher_filter_term_list(&$options, $cache = FALSE, $settings = array()) {
  $cached = '';
  if ($cache) {
    $cache_name = "tpf_widget";
    if (count($settings)) {
      foreach ($settings as $value) {
        $cache_name .= "_" . $value;
      }
    }
    if ($cached = _taxonomy_publisher_filter_get_cache($cache_name)) {
      $options = $cached;
      return;
    }
  }
  if (empty($cached)) {
    _taxonomy_publisher_filter_term_list_by_tid($options);
    if ($cache) {
      _taxonomy_publisher_filter_set_cache($cache_name, $options);
    }
  }
}