function i18n_panels_panels_delete_display in Panels 7.3
Implements hook_panels_display_delete().
Parameters
int $did: Id of the display to delete.
File
- i18n_panels/
i18n_panels.module, line 168 - Internationalization (i18n) submodule: Panels translation.
Code
function i18n_panels_panels_delete_display($did) {
// Fetch uuid to delete the translations.
$uuid = db_select('panels_display')
->fields('panels_display', array(
'uuid',
))
->condition('did', $did)
->execute()
->fetchColumn();
// Build a dummy display.
$display = (object) array(
'uuid' => $uuid,
);
// Check if this display was just saved in the db.
if (!_18n_panels_is_exported_panels_display($display)) {
// If the display was just saved in the db remove all translations.
i18n_string_object_remove('display_configuration', $display);
// Remove related pane translations too.
$pids = db_select('panels_pane')
->fields('panels_pane', array(
'pid',
))
->condition('did', $did)
->execute()
->fetchCol();
i18n_panels_panels_pane_delete($pids);
}
else {
// If the display is exported leave the translated strings but give the user
// a hint how to clean up.
drupal_set_message(t('The reverted panels display(s) were exported, please run a <a href="!link">string refresh</a> to update the translatable strings.', array(
'!link' => url('admin/config/regional/translate/i18n_string'),
)), 'warning', FALSE);
}
}