You are here

function _get_referencable_terms_from_view in Taxonomy Term Reference Filter by Views 7.2

Get the TermsImplements hook_views_plugins_alter().

3 calls to _get_referencable_terms_from_view()
term_reference_filter_by_views_field_widget_form_alter in ./term_reference_filter_by_views.module
Implements hook_widget_field_form(). Alters the Taxonomy Term Reference Widgets.
term_reference_filter_by_views_taxonomy_autocomplete in ./term_reference_filter_by_views.module
Autocomplete callback for widgets that has autocomplete.
term_reference_references_dialog_plugin_display::render in views/term_reference_references_dialog_plugin_display.inc
Render this display.

File

./term_reference_filter_by_views.module, line 276

Code

function _get_referencable_terms_from_view($field, $instance, $match = NULL, $limit = 0, $ids = NULL, $width_tid = TRUE) {
  $terms = array();
  $view_terms = _get_view_results_for_term_reference_field($field, $instance, $match, $limit, $ids);
  foreach ($view_terms as $tid => $row) {

    // Strip things like starting/trailing white spaces, line breaks and tags.
    $terms[$tid] = preg_replace('/\\s\\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($row)))));
    if ($width_tid) {
      $terms[$tid] .= " (id:{$tid})";
    }
  }
  return $terms;
}