Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/10/2023 in all areas

  1. Issue fixed and module updated! Should be good but let me know if you notice anything else @gornycreative
    2 points
  2. TextformatterFootnotes Github: https://github.com/eprcstudio/TextformatterFootnotes Modules directory: https://processwire.com/modules/textformatter-footnotes/ This textformatter adds footnotes using Markdown Extra’s syntax, minus Markdown About This textformatter was primarly created to ease the addition of footnotes within HTML textareas (CKEditor or TinyMCE) using Markdown Extra’s syntax. It will also retain any inline formatting tags that are whitelisted. Usage To create a footnote reference, add a caret and an identifier inside brackets ([^1]). Then add the footnote in its own line using another caret and number inside brackets with a colon and text ([^1]: My footnote.). It will be put automatically inside the footnotes block at the end of the text. Notes the identifier has to be a positive number (int) if a reference has no corresponding footnote (or vice-versa) based on their identifier, both will be ignored and left as is by default references/footnotes are sequenced per field, meaning if you are outputting several fields with this textformatter each footnotes group will start from 1 block elements are not guaranteed to work in footnotes and are thus removed by defaut Options In the module settings you have some options regarding the generated markup: you can change the icon (string) used for the backreference link you can change the classes used for the wrapper, the reference and backreference links you can decide to sequence the footnotes from different fields continuously, instead of restarting from 1 you can edit the list of whitelisted HTML tags that won’t be removed in the footnotes Hook Dynamically change options If you want to have a more granular control over the footnotes (e.g. per field), you can use this hook: $wire->addHookBefore("TextformatterFootnotes::addFootnotes", function(HookEvent $event) { $str = $event->arguments(0); $options = $event->arguments(1); $field = $event->arguments(2); if($field != "your-field-name") return; // Say you want to change the icon for a <svg> $options["icon"] = file_get_contents("{$event->config->paths->templates}assets/icons/up.svg"); // Or change the wrapper’s class $options["wrapperClass"] = "my-own-wrapper-class"; // Put back the updated options array $event->arguments(1, $options); }); Check the source code for more options. Group all footnotes in a page Since a textformatter is applied per field, its footnotes are appended right after its content. If you have multiple fields and want to ouput all footnotes in the same place you can use the outputAsArray option: // in init/ready.php $wire->addHookBefore("TextformatterFootnotes::addFootnotes", function(HookEvent $event) { $options = $event->arguments("options"); $options["outputAsArray"] = true; $event->arguments("options", $options); }); $wire->addHookAfter("TextformatterFootnotes::addFootnotes", function(HookEvent $event) { if(empty($event->return["footnotes"])) return; $footnotes = setting("footnotes") ?: []; $footnotes = [ ...$footnotes, ...$event->return["footnotes"] ]; setting("footnotes", $footnotes); }); // in your template file echo $modules->get("TextformatterFootnotes")->generateFootnotesMarkup(setting("footnotes")); Note: if you are using this method to output your footnotes and want to dynamically change the markup/icon, please use the TextformatterFootnotes::generateFootnotesMarkup hook instead of TextformatterFootnotes::addFootnotes
    1 point
  3. Quick question regarding your usage: were you calling the function on its own? Or was it through the textformatter applied to a text field? What I could do is check if $options is not an array and in this case assume it's $field, but the $field argument is not used within the function as it's just there so you can do field-specific stuff using the hook. Edit: oh wait I just saw my mistake... on line 44 ?
    1 point
  4. @gornycreative the issue is already fixed on the latest dev: There has just not been a version bump since then.
    1 point
  5. & this from Google search (not tested):
    1 point
  6. You can find the name of the admin by looking at the page with ID 2 in the database. Since you have access to the filesystem, you can also just echo $config->urls->admin somewhere. To reset the admin password, put this into a template and execute it: $u = $users->get(41); $u->of(false); $u->pass = 'hunter2'; $u->save(); 41 is usually the superuser who installed the site. If it isn’t you can try to find the account by selecting one with the role “superuser”.
    1 point
  7. ProcessWire doesn't care what the folder is called it lives in. I could be just /var/www/ or /public_html/ or /home/user/_client/domain.tld/. There are a few things you really need to take care of: $config->httpHosts $config->db* and the whole database setup of course file/folder permissions https://processwire.com/docs/security/file-permissions/ take care of all .htaccess files, especially in the root You could just move all files by hand or use either ProcessExportProfile or Duplicator. Some even just use Git to move a ProcessWire instance around. It get's a bit more complicated in case you want to run ProcessWire inside a subfolder of another project. But there are different threads about this here in the forum.
    1 point
  8. Yes, I do intend to create a new module similar to HannaCodeDialog that supports TinyMCE. But I don't have an estimated date for when it will be ready. For many of my modules, the situation has been that I work on them when I have a need for them myself. And I have quite a number of modules based on CKEditor that I use frequently and that would need to be redeveloped for TinyMCE before I personally can contemplate changing my RTE fields from CKEditor to TinyMCE. So I have quite a lot of work ahead of me and consequently I don't think HannaCodeDialogMCE is going to completed in the very near future.
    1 point
  9. A customer wanted to disable save ( $config->demo ) for users with a specific role. I created a module for that. If you need it, it's over here. To select the role(s), go to the modules config settings. download at github
    1 point
×
×
  • Create New...