Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/27/2021 in all areas

  1. A few days ago I stumbled upon this old module, which had been laying in the modules directory of one of my sites since 2017 in a half-finished state. I have no recollection why I left it like that, but figured it might be useful for someone, so here we go: https://github.com/teppokoivula/Snippets https://processwire.com/modules/snippets/ Snippets is a tool for injecting front-end code snippets (HTML/JS/CSS) into page content. The way it works is that you create a snippet — say, a Google Analytics tag — and then choose... which element it should be tied to (there are some pre-populated choices and custom regex option), whether it should be placed before/after said element or replace it entirely, and which pages the snippet should apply to. The "apply to" option also has some ready to use options (such as "all pages" and "all non-admin pages") or you can select specific pages... or use a selector. Snippets are regular markup, with the exception that you can use values from current page (behind the scenes the module makes use of wirePopulateStringTags()). Available hooks: Snippets::isApplicable, which receives the snippet object and current Page object as arguments and returns a boolean (true/false). Snippets::applySnippet, which receives the snippet object, page content (string), variables (an object derived from WireData), and an array of options for wirePopulateStringTags() as arguments and returns the modified page content string. That's just about it. It's a pretty simple module, but perhaps someone will find this useful ?
    3 points
  2. @Macrura - thanks to @Robin S in another post: https://processwire.com/talk/topic/15902-hannacodedialog/?do=findComment&comment=208498 // add hanna code dialog to fields even though the Hanna code text formatter isn't applied // https://processwire.com/talk/topic/15902-hannacodedialog/?do=findComment&comment=208498 $this->wire()->addHookAfter('InputfieldCKEditor::renderReadyHook', function (HookEvent $event) { $inputfield = $event->object; $field = $inputfield->hasField; // For your field name(s)... if(!$field || $field->name !== 'XXXX') return; $config_name = "InputfieldCKEditor_{$field->name}"; $config_name_matrix = "InputfieldCKEditor_{$field->name}_matrix"; $config = $this->wire('config'); $js_config = $config->js(); foreach($js_config as $key => $value) { if($key === $config_name || strpos($key, $config_name_matrix) === 0) { $js_config[$key]['extraPlugins'] .= ',hannadropdown,hannadialog'; $config->js($key, $js_config[$key]); } } });
    2 points
  3. @PWaddict, the issue you reported earlier should now be fixed. Sorry for the delay.
    1 point
  4. Hi @Macrura just trying this out (yeah, I know I'm late to the party) and it works great. I have just put in an issue on github for your consideration.
    1 point
  5. @mlfct, the issue mentioned above should now be fixed in SearchEngine version 0.30.2. Thanks for letting me know about this and sorry for taking so long to solve it ?
    1 point
  6. Hi Teppo. First of all, many thanks for you time and for your suggestions. Very appreciated. At the moment I’m on mobile and far from my pc. ASAP I will check it and fix as you pointed. In the meantime, please split the discussion as you see fit and as it’s more convenient for the forum. Many thanks again for your support.
    1 point
  7. Hey @teppo, i got a quick question - maybe it is even trivial: I just upgraded from SE 0.26 to 0.30.1 and i am running into some issues with the JSON output. Up until now it was working flawlessly, when i was querying my search endpoint via AJAX. The output was just dead simple: $searchEngine = \ProcessWire\modules()->get('SearchEngine'); header('Content-Type: application/json'); return $searchEngine->renderResultsJSON(); But somehow this endpoint returns no results on 0.30.1, when using the same query as on 0.26: { "query": "xyz" } I also did a quick debug query via the SE admin panel, which returns all the expected results. Am i overlooking some changes?
    1 point
×
×
  • Create New...