Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by masslevel

  1. 3 hours ago, adrian said:

    Hi @masslevel - Table field support could certainly be added to BCE. It already supports other multi-value field types using a separator like: |

    You could add code for Table fields here: https://github.com/adrianbj/BatchChildEditor/blob/339624b0a14a9f403ae73b37a08f3e0f5f8d6136/BatchChildEditor.module#L1608

    You should be able to find the code you need here: https://github.com/adrianbj/TableCsvImportExport/blob/a4e6ad668fd92f668546ba62cf726d29871b6d05/TableCsvImportExport.module#L341

    If you can add this, I'd be happy to accept a PR for BCE.


    Thanks for your reply @adrian and your confidence in my very basic coding skills ;-). I would love to do a PR but I don't even know how to start in integrating your code. Sure I can try copy-pasting, but I guess it takes a bit more. I will certainly try and see how it goes since I definitely need / would love to have that feature.

  2. Hi, guys!

    I'm currently building a product catalog .CSV-file to be imported by BCE. I have a massive amount of entries (product highlights) to import and I want to use ProFields Table since it does support multi-language.

    Is there any way BCE could support ProFields Table with a single column containing a multi-language ckeditor textarea?
    I wanted to add rows to the table field via row1content|row2content|row3content... in the .CSV-file.

    The multi-language part isn't essential.

    TableRow isn't supported afaik - at least pairing the field (mytablefield.mycolumn) isn't working.

    I looked at @adrian's Table CSV Import / Export Module but this is, at least in the admin, only for populating single pages. Maybe I can build an import script using the Table CSV Import module, match and populate the pages imported via the initial .CSV-file, but it would be a lot better to manage if it could all be done with the "product catalog" .CSV-file that also creates the product pages - and better for future updates by me and editors.

    Anyone has an idea? Many thanks in advance!


    • Like 1
  3. 23 hours ago, PWaddict said:

    The following hook should do what you want. It's based on old @Soma's post. All you have to is to edit $myslug with your random hash generator.

    $wire->addHookBefore("Pages::saveReady", function(HookEvent $event) {
      $page = $event->arguments[0];
      if ($page->template->name != 'news-article') return;
      foreach ($this->languages as $lang) {
        $lname = $lang->isDefault() ? '' : $lang->id;
        $default = $this->languages->get("default");
        $myslug = '-myslug';
        if ($page->title->getLanguageValue($lang)) {
          $page->set("name$lname", $page->title->getLanguageValue($lang) . $myslug);
        } else {
          $page->set("name$lname", $page->title->getLanguageValue($default) . $myslug);


    Thanks so much, @PWaddict. Now the slug gets applied also to other languages. Awesome! Many steps closer. What is still happening is:

    • When I publish the page or save it, the page name/url gets a new slug everytime.
      How can I restrict this so that a new page name gets only generated once? When the URL should be changed afterwards, it should only be possible manually or for example when the page name field is cleared.

      The problem is when an editor decides to unpublish/publish or just does a simple resave of the page, it will have a new URL.
    • When I create a new article page in the Add New screen and press save, I get redirected to the page edit screen, which is correct but it shows an red error notice on top:
      Session: Warning, the name you selected "my-new-article" was already in use and has been changed to "my-new-article-myslughash". 

    Your snippet is very close. Thank you for that.

    I will try to make some changes to it - not really sure how exactly ? but trial and error I guess. Maybe changing Pages::saveReady to something different so the page->name gets only generated once? Don't know yet what to do about the warning.

  4. 5 hours ago, rafaoski said:

    I was wondering if it would be better to change the name of the page after publishing ...

    wire()->addHookBefore('Pages::publishReady', function($event) {
        $page = $event->arguments('page');
        if ($page->template->name == 'news-article') {
    		$page->name = $page->title . '-myslug';


    Thanks for your reply and input, @rafaoski. That would be fine too, BUT I sadly encounter the following issues:

    • '-myslug' in my simplified example is actually a random hash generator. If I unpublish the page and republish it, another string is attached to the already existing one (ex. my-article-my-slug-my-slug after the second publish.
    • even when using the Pages::publishReady hook, the slug is only appended to the default language page name/url and not to other languages.
    • Like 1
  5. Hello!

    I apologize in advance if I missed something on the forums. I'm not yet that experienced with hooks and already tried a lot. Maybe someone else has an idea or could give me a hint in the right direction.

    • In my ready.php file I'm creating a random generated URL slug on Pages::setupNew for a specific template.
    • When creating a page and I type in the default language title and leave the other languages blank, the slug gets appended to the page names because the pages have the same url/slug/title but in different trees ( ex. /myarticle-myslug/ and /en/myarticle-myslug/ )
    • When creating a page and I enter a title for each language, the slug gets only applied to the default language and I get an error that the name for the default language already exists and it was changed to /myarticle-myslug/. The other language gets the page name /en/my-article/ applied.
    • Additionally I noticed that the settings from Module -> Page Name (InputfieldPageName) are not applied when creating the page name using the code below. So non-ascii characters get stripped instead of sanitized

    Here is a simplified code snippet that I have in the ready.php file:

    wire()->addHookBefore('Pages::setupNew', function($event) {
        $page = $event->arguments('page');
        if ($page->template->name == 'news-article') {
            $page->name = $page->title . '-myslug';

    I've read this topic and if this still applies, LanguageSupportPageNames isn't used on Pages::setupNew.  Especially the post by @Soma looks interesting but I'm not sure how to apply it.

    Thank you very much in advance.

  6. 7 hours ago, dragan said:

    I would probably strip any extra p tags with a hook.

    It looks like all MathJax blocks create something like this:

    <p><span class="math-tex">...</span></p>

    It would be quite easy to just render the very first p tag which has the above span class .math-tex inside, and delete everything else.

    I'm sure as time goes by, authors won't even try to add more than one line anymore :)

    I also quickly tried some cheap CSS hacks, but they don't really work... e.g. restricting the RTE height:

    height: 62px;
    resize: none;
    overflow: hidden;


    Thanks @dragan. Yeah I might have to put in a hook anyway. Thanks for looking into it.


    3 hours ago, Robin S said:

    The suggestion here worked for me. If your CKEditor field is named "formula", create a file "config-formula.js" in /site/modules/InputfieldCKEditor/ with contents:

    CKEDITOR.editorConfig = function( config ) {
        config.keystrokes =
                [ 13 /* Enter */, 'blur'],
                [ CKEDITOR.SHIFT + 13 /* Shift + Enter */, 'blur' ]


    This is actually working! I really thought I tried every syntax combination. Interestingly when you press Enter it puts the Save-button into focus on the page (in Chrome).
    Thank you so much, Robin.

    I guess I can go ahead and build something with your suggestions. Thank you both very much!


    If anyone wants to build something similar: Here is my current config-fieldname.js in /site/modules/InputfieldCKEditor/
    You can also turn off autoparagraphs so you can format the text in your template more easily. I also added a change for the underline icon since the default CKEditor behavior using <u> as underline element isn't semantic html how it will probably be used in this case.

    CKEDITOR.editorConfig = function( config ) {
        // don't create <p>-tags
        config.autoParagraph = false;
        // underline icon adds span.underline instead of <u>
        config.coreStyles_underline  = { element : 'span', attributes : {'class': 'underline'}};
        // blur Enter and Shift+Enter keys
        config.keystrokes =
                [ 13 /* Enter */, 'blur'],
                [ CKEDITOR.SHIFT + 13 /* Shift + Enter */, 'blur' ]


  7. 1 hour ago, dragan said:

    Try the MathJax CKEditor plugin



    it should even be available with AdminOnSteroids (a highly recommended plugin with tons of tools, extras, helpers, customization options etc.)

    Thanks @dragan for your excellent suggestion. I will look into MathJax. Since I was trying to keep it vanilla/basic I wasn't looking into AdminOnSteroids but will definitely have a look now - thanks!

    I'm still not sure how I could restrict CKEditor to a single line/row.

    Since I want the data to be searchable, filterable and the output to be formatted in different ways in the front-end, I wanted to use a Pro Field Table or a repeater field for each entry/formula/ingredient.

    I'm pretty sure that there will be many surprises in the rendered output if content editors are allowed to create new lines in the backend with this field ;-). I could post-process the output via a text formatter (paragraph stripper etc.) or explain it to the content editors, but limiting it to a single line/row would be a much safer solution in my opinion.

    Looks like if the "doNothing" plugin or the blockedkeystrokes approach (which I'm not really a fan of) isn't working, there isn't an easy way to do this afaik.

  8. Hello, community!

    Does anyone have an idea how to limit a Textarea field with CKEditor to just one line/row?

    I'm using the Textarea field in a repeater and CKEditor because it needs to hold formulas. I would use a simple text field, but I need the formatting options like super-/subscript, underline etc.

    None of the below methods seem to be working.

    Are there any other methods you may know or have used before that can restrict CKEditor to a single row? Or should I use a completely different approach for entering/formatting the content?

    I tried these approaches:

    #1 Redirecting enter and shift+enter keys
    When the doNothing plugin is enabled CKEditor won't load on the edit page - the space is blank. There's a parsing error. I tried to modify the plugin - no luck.

    #2 Using the blockedKeystrokes function that was introduced in CKEditor 4

    • as a plugin (13 = enter key)
      config.blockedKeystrokes( 13, CKEDITOR.SHIFT + 13 );

      Getting: config.blockedKeystrokes is not a function. Tried also with editor.blockedKeystrokes

    • in the config.js and config-fieldname.js

      config.blockedKeystrokes = [ 13, CKEDITOR.SHIFT + 13 ];

      is getting ignored. does nothing.

    • in the Input field settings (Custom Config Options) in ProcessWire
      blockedKeyStrokes: 13, CKEDITOR.SHIFT + 13

      is getting ignored. does nothing.


    Thank you so much in advance.

  9. Thank you for the great update, kongondo. I will try the new version out very soon.

    I use Media Manager extensively on the project I'm currently working on and trying to do - let's call it - context-based image descriptions.

    I have many images that will be displayed on different product pages in a slideshow. So the same image/file will be used in different contexts and need a different description depending on the page.

    The reason is that multiple products are shown on the same image.

    • a) The obvious solution would be uploading the image multiple times as needed and give them different descriptions, but I really don't like this solution since a visitor would have to download more data than needed. That's not really optimized since the project already uses responsive images and lazy loading etc. yadda yadda ;-).
    • b) I thought about using a repeater, but I can't use one since the site is already running on ProcessWire 3.0 and Media Manager isn't working in Processwire 3.0 repeater fields. If there would be a quick fix, I'll bet Francis would have included the fix in the latest update.
    • c) Maybe there is another way. Any suggestions?

    Thank you so much.


  10. if($page->disable_default_language && $user->language->isDefault()) throw new Wire404Exception(); 
    if($user->language->isDefault()) $user->language = $languages->get("en-us"); // or whatever you want your default to be

    Once again - simple and elegant. Thanks, Ryan! Awesome. I guess my mind is still living in a framework/CMS world where everything needs to be constrained and complicated. ProcessWire lets you breathe.

    • Like 1
  11. Hello guys,

    this thread has already been proven extremely informative. Thank you for that.

    I have a quick question and I'm not sure how to approach it using LanguageSupportPageNames, LanguageSupportFields (latest dev version 2.3.4) - or if it's even possible.


    - Multiple languages (default, de, fr...)

    - PW Multi-Language Support (PageNames etc.)

    What If I want to create/publish a page only in DE language, and that page should not be available in the default language?

    It could also be a case of "slow on the uptake" on my part. So apology in advance ;-).

    Any feedback is much appreciated. Thank you!



  12. Hello PW community,
    I hope my post fits correctly in this forum category.
    Great to be here. Great to have found my new favorite CMS and an awesome community! I learned a lot from you guys by lurking on the forums and I hope can help someone else in the near future. I could need some advice about a very specific subdomain setup with a single PW install.
    A multi-language multi-site setup
    • 1x top-level domain but with subdomains for country specific site versions
    • Some subdomains have the same language (different country), others differ

      Current setup using apeisa's Multisite module
      In Page Tree        Domain           Country              Language
      /                   www.domain.com   International site   english
      /en.domain.com/     en.domain.com    United Kingdom       english
      /de.domain.com/     de.domain.com    Germany              german
      /at.domain.com/     at.domain.com    Austria              german
      /ch.domain.com/     ch.domain.com    Switzerland          german
      /fr.domain.com/     fr.domain.com    France               french
    I guess the name for something like that is "Geo-Targeted Subdomain Approach". I first wanted to do a folder-based language approach but the requirements have changed - thanks to the SEO guys *yay* :-/.
    In advance
    Since the project must be finished during the next few weeks, if anyone of you PW professionals is available short term, I would be interested in talking to you to find a solid solution to make this work.
    The site's content will grow soon and I'm concerned how the client will be able to manage all of his different country sites (subdomains).
    For example my current challenges are with managing lots of content in this environment, PageListSelect, sitemap.xml generation and more. The site is working but things are starting to get complicated and some functionality undesirable. I guess mostly of how the subdomains are set up with the Multiside Module. 
    My question
    I don't know how I can efficiently marry the multi-language features of PW and this multi-site setup with subdomains. Also there may be other solutions for the subdomain setup beside the Multiside module.
    If any of you has an idea, did something similar or could give me some pointers in how you would approach a setup like this - that would be so awesome!
    The Challenge and options in how to prevent a content management Massacre
    • Managing multi-language content in a multi-site environment, preferable with single pages and not duplicate content
    • Can it be done with LanguageSupportPageNames of PW 2.3.1/2.3.2 dev branch? I'm still not sure If I should be using the dev branch for a live production site.
    Current setup
    I have already set this up and it's working fine using apeisa's Multisite module - which was a real life saver, since the site had to go live very quickly in a light/base version.
    The site content
    • Company with a single product and pages like support (can be many pages), faq, forms etc in each country
    • All countries (subdomains) describe the same content, but text and images can be different on subdomains in a different or same language
    • All subdomains/sites have many pages in common but not every page does exist in every country.
    • Most content is currently duplicated on all domains and this creates a mess as the site grows obviously.
    • Have not found an efficient solution for a multi-site/multi-language page/field setup
    • No PW language support is currently in use
    • I already thought a lot about how to reduce complexity of my setup, created some working snippets but encountered some problems.
    • Was thinking about letting the content live somewhere hidden on the site, creating my own function or by using something like this and pulling everything in with a nice and easy configuration (field to select a country etc..), which with my PHP/PW knowledge sounds insane to be build by myself.
    I have more information, but I didn't want to spam this post - hrm *cough*, as I've done already.
    Phew, sorry for the long post. Any feedback is much appreciated.
    Thank you so much in advance and thanks for reading this.
  • Create New...