You are here

function synonyms_behavior_implementation_delete in Synonyms 7

Delete behavior implementation from database.

Parameters

array $behavior_implementation: Behavior implementation array, such as one from synonyms_behavior_get() or alike

8 calls to synonyms_behavior_implementation_delete()
AbstractAutocompleteSynonymsWebTestCase::testAutocompleteMenuPath in ./synonyms.test
Test autocomplete menu path.
NodeSearchSynonymsWebTestCase::testSearchTermSynonym in synonyms_search/synonyms_search.test
Test searching nodes by a term synonym.
NodeSearchSynonymsWebTestCase::testSearchTermSynonymEntityReference in synonyms_search/synonyms_search.test
Test searching nodes by a term synonym when referenced by entity reference.
SynonymsProviderPropertyWebTestCase::setUp in synonyms_provider_property/synonyms_provider_property.test
SetUp method.
SynonymsSynonymsWebTestCase::testSynonyms in ./synonyms.test
Test the functionality of synonyms.

... See full list

File

./synonyms.module, line 1162
Provide synonyms feature for Drupal entities.

Code

function synonyms_behavior_implementation_delete($behavior_implementation) {
  $behavior_definition = synonyms_behaviors();
  $behavior_definition = $behavior_definition[$behavior_implementation['behavior']];
  $disabled_callback = ctools_plugin_get_function($behavior_definition, 'disabled callback');
  if ($disabled_callback) {
    foreach (synonyms_behavior_get($behavior_implementation['behavior'], $behavior_implementation['entity_type'], $behavior_implementation['bundle'], TRUE) as $enabled_behavior_implementation) {
      if ($enabled_behavior_implementation['provider'] == $behavior_implementation['provider']) {
        $disabled_callback($behavior_definition, $behavior_implementation);
        break;
      }
    }
  }
  db_delete('synonyms_settings')
    ->condition('provider', $behavior_implementation['provider'])
    ->condition('entity_type', $behavior_implementation['entity_type'])
    ->condition('bundle', $behavior_implementation['bundle'])
    ->condition('behavior', $behavior_implementation['behavior'])
    ->execute();
}