You are here

public function OgVocab::prepareAutoComplete in OG Vocabulary 7

Helper function; Re-create the autocomplete path.

Parameters

$sub_element: The element that should be changed, passed by reference.

1 call to OgVocab::prepareAutoComplete()
OgVocab::getFormElement in includes/og_vocab.og_vocab.inc
Return form element.

File

includes/og_vocab.og_vocab.inc, line 176
A class used for messages.

Class

OgVocab
@file A class used for messages.

Code

public function prepareAutoComplete(&$sub_element) {

  // Rebuild the autocomplete path.
  $path = explode('/', $sub_element['#autocomplete_path']);
  $sub_element['#autocomplete_path'] = 'og-vocab/autocomplete';

  // Add autocomplete type
  $sub_element['#autocomplete_path'] .= "/{$path[2]}";

  // Add the OG-vocab entity ID.
  $sub_element['#autocomplete_path'] .= "/{$this->id}";

  // Add the entity ID.
  $sub_element['#autocomplete_path'] .= "/{$path[6]}";
  if (!empty($path[7])) {

    // Add the text.
    $sub_element['#autocomplete_path'] .= "/{$path[7]}";
  }
}