You are here

public function i18n_string_textgroup_default::string_remove in Internationalization 7

Remove string object.

Return value

SAVED_DELETED | FALSE (If the operation failed because no source)

4 calls to i18n_string_textgroup_default::string_remove()
i18n_string_textgroup_cached::string_remove in i18n_string/i18n_string.inc
Remove string object.
i18n_string_textgroup_default::context_remove in i18n_string/i18n_string.inc
Remove source and translations for user defined string.
i18n_string_textgroup_default::string_add in i18n_string/i18n_string.inc
Add source string to the locale tables for translation.
i18n_string_textgroup_default::string_update in i18n_string/i18n_string.inc
Update / create / remove string.
1 method overrides i18n_string_textgroup_default::string_remove()
i18n_string_textgroup_cached::string_remove in i18n_string/i18n_string.inc
Remove string object.

File

i18n_string/i18n_string.inc, line 509
API for internationalization strings

Class

i18n_string_textgroup_default
Textgroup handler for i18n_string API

Code

public function string_remove($i18nstring, $options = array()) {
  $options += array(
    'watchdog' => TRUE,
    'messages' => $this->debug,
  );
  if ($source = $i18nstring
    ->get_source()) {
    db_delete('locales_target')
      ->condition('lid', $source->lid)
      ->execute();
    db_delete('i18n_string')
      ->condition('lid', $source->lid)
      ->execute();
    db_delete('locales_source')
      ->condition('lid', $source->lid)
      ->execute();
    $this
      ->cache_set($source->context, NULL);
    if ($options['watchdog']) {
      watchdog('i18n_string', 'Deleted string %location for text group %textgroup: %string', $i18nstring
        ->get_args());
    }
    if ($options['messages']) {
      drupal_set_message(t('Deleted string %location for text group %textgroup: %string', $i18nstring
        ->get_args()));
    }
    return SAVED_DELETED;
  }
  else {
    if ($options['messages']) {
      drupal_set_message(t('Cannot delete string, not found %location for text group %textgroup: %string', $i18nstring
        ->get_args()));
    }
    return FALSE;
  }
}