You are here

function LinkitSearchPluginTaxonomy_term::buildSettingsForm in Linkit 7.3

Overrides LinkitSearchPlugin::buildSettingsForm().

Overrides LinkitSearchPluginEntity::buildSettingsForm

File

plugins/linkit_search/taxonomy_term.class.php, line 76
Define Linkit term search plugin class.

Class

LinkitSearchPluginTaxonomy_term
Reprecents a Linkit term search plugin.

Code

function buildSettingsForm() {
  $form = parent::buildSettingsForm();

  // The entity plugin uses the entity name for the #token_types, but terms
  // is a special case, its name is "Taxonomy_term" and the tokens are defined
  // (in the taxonomy module) with just "term".
  // If the token modules is installed.
  if (isset($form[$this->plugin['name']]['token_help']['help']['#token_types'])) {
    $form[$this->plugin['name']]['token_help']['help']['#token_types'] = array(
      'term',
    );
  }
  else {

    // Get supported tokens for the term entity type.
    $tokens = linkit_extract_tokens('term');
    $form[$this->plugin['name']]['result_description']['#description'] = t('Available tokens: %tokens.', array(
      '%tokens' => implode(', ', $tokens),
    ));
  }
  return $form;
}