You are here

protected function AbstractSelectSynonymsWebTestCase::synonymSelectKey in Synonyms 7

Form a key for the option of a synonyms friendly select.

Parameters

object $entity: Fully loaded entity for which to generate the key

string $synonym: If the option, whose key is being generated, comes from a synonym, then supply it here

Return value

string Key for the option of a synonym friendly select

4 calls to AbstractSelectSynonymsWebTestCase::synonymSelectKey()
AbstractSelectSynonymsWebTestCase::assertSynonymsSelect in ./synonyms.test
Assert correctness of the synonyms-friendly select widget.
CommerceProductReferenceSelectSynonymsWebTestCase::testWidget in synonyms_commerce/synonyms_commerce.test
Test main functionality of the widget.
EntityReferenceSelectSynonymsWebTestCase::testWidget in ./synonyms.test
Test main functionality of the widget.
TaxonomyTermReferenceSelectSynonymsWebTestCase::testWidget in ./synonyms.test
Test main functionality of the widget.

File

./synonyms.test, line 1154
Tests for the Synonyms module.

Class

AbstractSelectSynonymsWebTestCase
Test "Synonyms friendly select" widget of Synonyms module.

Code

protected function synonymSelectKey($entity, $synonym = NULL) {
  $entity_id = entity_extract_ids($this->behavior_implementation['entity_type'], $entity);
  $key = $entity_id[0];
  if ($synonym) {
    $key .= ':' . drupal_html_class($synonym);
  }
  return $key;
}