Hi everybody,

I'm working on several multi sites with the same CKEditor profile, and shared featured but different paths for editor styles and editor.css. Depending on conditions (e.g. domain or theme) I needed additional tokens.

Therefore I have created a patch with several hooks to support this new feature and implemented the hook to provide current functionality.

Instead of the current:
%h - host
%t - theme
%m - module

You can extend or alter these tokens with e.g.:
%site - site config path
%activetheme - current active theme
%domaintheme - current domains theme

Please review my work and let me know this functionality is interesting for the ckeditor module or code improvements are needed.

Thanks!

Cheers,

Eric

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericclaeren created an issue. See original summary.

ericclaeren’s picture

Issue summary: View changes
ericclaeren’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 2: ckeditor-style-css-tokens-2713419-7.x-1.x-dev.patch, failed testing.

The last submitted patch, 2: ckeditor-style-css-tokens-2713419-7.x-1.x-dev.patch, failed testing.

rudiedirkx’s picture

  1. Invalid HTML: </br>
  2. Usually, hook_x_alter alters the 'raw' information from hook_x, not the semi-processed information
  3. What does this mean?: "Keys are filtered by alpha numeric, array key: Key_1 will result in token %key1." << That last doesn't seem to be true...
  4. It's very useful if api.php mentions specifically what's inside $context, maybe in a sub list in the comment, with descriptions.

This is a great addition! %h is always too broad, and %t is usually too specific. Maybe ckeditor could add %s (e.g. /sites/mysite/) as a token by default too? It's in between %h and %t specificity-wise.

ericclaeren’s picture

Status: Needs work » Needs review
ericclaeren’s picture

ericclaeren’s picture

Status: Needs review » Needs work

The last submitted patch, 9: ckeditor-style-css-tokens-2713419-8-7.x-1.x-dev.patch, failed testing.

ericclaeren’s picture

Damn uploaded the wrong patch, this is the correct one.

Status: Needs review » Needs work

The last submitted patch, 12: ckeditor-style-css-tokens-2713419-9-7.x-1.x-dev.patch, failed testing.

rudiedirkx’s picture

Status: Needs work » Needs review

Maybe tests?

rudiedirkx’s picture

Status: Needs review » Reviewed & tested by the community

https://www.drupal.org/pift-ci-job/622798 passed, and I've tried it, and I like it. %s is SO valuable!

jcisio’s picture

Status: Reviewed & tested by the community » Needs work

Thanks, it's a reasonable add-on. I've only done a quick review:
- Coding standards: unneeded empty trailing lines in docblocks, each sentence should end with ".", comments are wrapped at 80 characters but not before.
- Some copy/paste leftover: $context of hook_ckeditor_path_tokens_alter().
- The array keys are without "%" in the hook, but with "%" in the alter hook, which leads to confusion. I'd suggest add "%" prefix everywhere and do not force it (so a token could be without "%" prefix, it may use another prefix or no prefix at all).

steniya’s picture

Issue summary: View changes