We have client reports that the l10n_client shows up in the dialog and destroys wysiwyg_imageupload.
Sure we told them to deactivate the l10n_client (at least temporary) to make the dialog work again. But they still consider this a system bug.

Same as you disable admin_menu in the dialog case - isn't it possible to deactivate the l10n_client?

Comments

EugenMayer’s picture

Hi Miro,

how could we. Can i utilize a similar hook like exit / shutdown?

miro_dietiker’s picture

Project: WYSIWYG image upload - Inline images for your WYSIWYG » Localization client
Version: 6.x-2.8 » 6.x-2.x-dev

It seems to me l10n_client doesn't allow to deactivate it in certain conditions like admin_menu does.

Gabor is there a way to do so?
In admin_menu.module there's a function admin_menu_suppress(). This gets checked right before outputting the markup.

Gábor Hojtsy’s picture

Yeah, this function governs whether you see the UI or not:

function l10n_client_access($account = NULL) {
  if (!isset($account)) {
    global $user;
    $account = $user;
  }
  return user_access('use on-page translation', $account) && empty($account->data['l10n_client_disabled']);
}

We can add an API function to let you disable it from another module if needed.

EugenMayer’s picture

That would be perfect Gabor. It will be used by other libs like the modal-frame API also, so its generally needed. Thanks

Gábor Hojtsy’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev

Patch welcome. Let's have it in D7 and D6 too.

miro_dietiker’s picture

If we do it the admin_menu way, it would be:

function l10n_client_suppress($set = TRUE) {
  static $suppress = FALSE;
  if (!empty($set)) {
    $suppress = TRUE;
  }
  return $suppress;
}

function l10n_client_access($account = NULL) {
  if (!isset($account)) {
    global $user;
    $account = $user;
  }
  if (!user_access('access administration menu', $account) || l10n_client_suppress(FALSE)) {
    return FALSE;
  }
  return empty($account->data['l10n_client_disabled']);
}

Is this the way to go?
I could provide a patch then.

BTW: The function has a $account argument that is never used. I think we should reduce it to global $user case only to simplify.

SebCorbin’s picture

Status: Active » Needs work

Recommended solution, add a variable named l10n_disabled_paths check that the current_path() is not in it using drupal_match_path()

Need a UI too.

SebCorbin’s picture

Title: deactivate l10n_client in dialog » Deactivate l10n_client in certain paths
SebCorbin’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.