Jump to content

nurkka

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by nurkka

  1. The Multisite module (latest Version 0.0.6 from https://github.com/somatonic/Multisite/tree/dev) doesn't work correctly with the new link abstraction (since PW 3.0.6). When activated, the link abstraction feature adds the URL-parts of the Multisite-folders back to the URLs, so you'll end up with URLs like http://example.com/example.com/some-folder/some-page/ instead of http://example.com/some-folder/some-page/ I wrote a workaround, but unfortunately - since I didn't find a way to hook into the link abstraction - it's a core hack. I had to modify the methods sleepLinks() and wakeupLinks() in /wire/core/MarkupQA.php. In sleepLinks() I'm overriding the link modification, when a link points to a page, which doesn't belong to the current Multisite-branch. And in wakeupLinks() I'm stripping the Multisite-folder domain names from the given URLs. Since that doesn't make much sense in the long run, I wondered if anyone has a better solution? @ryan Ryan, could you perhaps make the link abstraction hookable? Or am I missing something? Every hint is very well appreciated. Thanks in advance!
  2. Hi, how is it possible to modify the settings of the html purifier instance that is used by InputfieldCKEditor? How can I get the correct instance $purifier? $purifier->set('Attr.AllowedFrameTargets', array('_blank','_top')); My goal is to allow link target "_top" *without* having to disable html purifier ...
  3. Thanks LostKobrakai, this is the trick I was missing.
  4. Hi Peter, yes that would work, though it's not very easy for the clients. I thought I missed a trick with dragging/dropping pages, but it looks like the pagetree simply lacks this feature. What would be the best way to post this as a feature request - in github issues or here in the forums?
  5. Hi, when moving a page in the page tree via drag'n'drop, it was not possible (for me) to move it one level down beneath another page. This only works, when the destination page already has a child page. Is there a trick to do drag and drop a page one level beneath another page, even if this page hasn't already got a child page? I tried this in Firefox and Chrome. Thanks in advance.
  6. Thanks for the module, Macrura. Currently I have page fields and option fields with InputAsmSelect on my pages. Now, with the module, the options are editable too, which leads to strange results. Is it possible to restrict the module to only modify page fields? I tried $field->type within InputfieldAsmSelect::render, but got no value back.
  7. As far as I know, there is no built-in way to do this. You would have to use a module or write one yourself. I found this post from ryan to be very helpful on that topic: https://processwire.com/talk/topic/1799-routes-and-rewriting-urls/#entry16754 In this thread you'll also find further information about rewriting urls. If you're rewriting urls there will certainly be side effects like the link module in ckeditor will not work properly anymore.
  8. You're right, it was the wrong hook. Now I'm using InputfieldCKEditor::processInput, but still don't get the right instance of MarkupHTMLPurifier. Next, I took a closer look at the code of InputfieldCKEditor.module and I tried to replace the hook method: public function ___processInput(WireInputData $input) { $value = trim($input[$this->name]); if($value == self::PLACEHOLDER_TEXT) return $this; // ignore value $value = $this->purifyValue($value); if($value != $this->attr('value')) { $this->trackChange('value'); $this->setAttribute('value', $value); } return $this; } The MarkupHTMLPurifier module is instantiated in the $this->purifyValue()-Method: if(is_null(self::$purifier)) self::$purifier = $this->wire('modules')->get('MarkupHTMLPurifier'); Is there any way to get self::$purifier from »outside«, i.e. from a hook method? If not, is it possible to replace the whole processInput-Method and call a custom instance of MarkupHTMLPurifier? I tried to do that, but it didn't work: public function hookMethod (HookEvent $event) { $this->message("Hook InputfieldCKEditor::processInput"); // the hook is called correctly $event->replace = true; // force replace the hook method $field = $event->object; $arguments = $event->arguments; // now I tried to adapt the code of the original method, but it didn't work. $value = trim($event->arguments[$field->name]); if($value == self::PLACEHOLDER_TEXT) return $field; $value = $field->purifyValue($value); if($value != $field->attr('value')) { $field->trackChange('value'); $field->setAttribute('value', $value); } return $field; } I think that must be possible, but how is it done correctly?
  9. Hi, the output of a CKEditor field is postprocessed by the MarkupHTMLPurifier module, which has no configuration settings in the backend. I want to tweak the html output, so I'm trying to change the MarkupHTMLPurifier settings. The easiest method would be, to change one line in MarkupHTMLPurifier.module, but I want to be save when updating ProcessWire. So I had the idea to change the module settings on runtime. To achieve that, I wrote following module: class configModifer extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Config Modifier Test', 'version' => 1, 'summary' => 'This module tries to change the settings of another module on runtime.', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookBefore('Inputfield::render', $this, 'beforeInputFieldRender'); } public function beforeInputFieldRender (HookEvent $event) { $purifier = wire()->modules->get('MarkupHTMLPurifier'); $purifier->set('HTML.Doctype', 'HTML 4.01 Transitional'); } } Unfortunately this doesn't work. The Hook is called, but it doesn't change the settings of MarkupHTMLPurifier. How can I change the module settings of MarkupHTMLPurifier on runtime? Or is there another way to achieve that? Thanks in advance.
  10. Thanks for your reply, LostKobrakai. I tried to put the plugin under /wire/, but that didn't work either. Then I renamed the plugin to »htmlwriter2« (located in /site/modules/InputfieldCKEditor/plugins/htmlwriter2/) and surprisingly that worked. I think there is a naming conflict with code in ckeditor.js. Perhaps, the plugin »htmlwriter« is already pre-installed or it has meanwhile been integrated in the CKEditor core. Nonetheless, I couldn't get it to work without installing it as »htmlwriter2«. Unfortunately, I also had no luck in configuring the plugin via the field settings of my »body«-Field. I tried the following JSON in the »htmlwriter2 settings«: {"selfClosingEnd": ">"} But that didn't work. I had to write this setting directly into the plugin file, but I would really like it better to be set via the backend. You asked, why someone would want to remove the trailing slashes of self closing tags – When I switched from XHTML to HTML5, I decided not to use trailing slashes anymore and I just wanted the HTML output to look equally, even if it comes from CKEditor. Next I will try to find out how the setting above can be set via the field settings in the ProcessWire backend.
  11. Hi, CKEditor generates <br /> instead of <br>, so I searched a method, to replace trailing slashes in self closing html tags. I found the CKEditor plugin Htmlwriter, which does just that, and installed it in /site/modules/InputfieldCKEditor/plugins/ in it's own subdirectory /htmlwriter/. Next I activated the plugin in my field configuration (field »body«) in the backend and added the required settings as JSON ({"selfClosingEnd": ">"}) to the now available »Htmlwriter settings« field. But that didn't work. So, I placed some debug code in Htmlwriter's plugin.js (console.log('plugin loaded') , but the message never showed up in the console. The same debug code in e.g. /wire/modules/Inputfield/InputfieldCKEditor/plugins/sourcedialog/plugin.js showed up perfectly. So, I assume the /site/modules/InputfieldCKEditor/plugins/htmlwriter/plugin.js isn't included at all, although it's configured in the field settings. I also get no error message, no 404s in the network panel or something like that. Additionally, if I try to set configuration settings in /site/modules/InputfieldCKEditor/config.js or /site/modules/InputfieldCKEditor/config-body.js they are ignored, while settings in the »Custom Config Options« field in the field settings work perfectly. Does anybody know what I am missing here? How is it possible to set up this CKEditor plugin properly in ProcessWire? Thanks in advance!
×
×
  • Create New...