Jump to content

Recommended Posts

The answer here below:

The menu-id can be found in the browser-url, e.g.: processwire/setup/menu-builder/edit/?id=1035 when you are editing your menu.

To render the menu

<?php

 //load the module
$menu = $modules->get('MarkupMenuBuilder');//Load the module. $menu is an example
//render by name, title or id
echo $menu->render(1035,array('default_title' => 1));  //render by ID   default title = 1 and you get ML-support
?>
 
In de Readme  you find echo $menu->render('1234');//render by ID but with brackets you get an error so, it should be echo $menu->render(1234);//render by ID
  • Like 1
Link to post
Share on other sites

@hansv,

Welcome to PW and the forums. Apologies I have been a bit busy and was not able to respond quicker. Glad you found the answer and thanks for finding the typo in the Readme I'll correct it. By the way, note that you can also pass a menu $page or an array of menu items in addition to the ID 

Link to post
Share on other sites

yeah, i've set it to 4 (just to make sure it's high enough), but the parent item is only marked current, when i include the children (include_children => 1).

but, with these settings the childpages are also included in the html of the menu, which i don't want.

here are my settings:

$menuOptions = array(
                    'current_class' => 'current',
                    'include_children' => 1,//show 'natural' MB non-native descendant items as part of navigation
                    'm_max_level' => 1,//how deep to fetch 'include_children'
                    'current_class_level' => 4,//how high up the ancestral tree to apply 'current_class'
             ); 

thanks!

@Torsten,

That's the current behaviour - only native menu builder child items & natural (tree) children associated via 'include_children' are affected by 'current_class_level'. I'll mull over extending the behaviour (via an API option) to include natural (tree) but non-associated children similar to the case you've described.

Link to post
Share on other sites

Hi guys,

I have a  similar / the same problem as Torsten. But somehow, if I set "current_class_level" to 2, it doesn't seem to apply, for reasons I don't understand. My site structure looks something like this

Home

about

used stuff

products

Tv

Home Cinema

Speakers

Streaming solutions

etc.

 

If I navigate to products, the script automatically assigns the css-class "active" to the selected menu item, which changes the color of the menu item in the navbar. If I navigate to one of the children of "products" (TV,Home cinema etc.) though, my top menu item "products" loses its css class. 

I thought I could prevent "products" from losing its css- class when browsing children of "products" by increasing the value of 'current_class_level' to something greater than 1.

But if I do so, it doesn't change anything, my menu item "products" still loses its class when I navigate to one of its children.

I hope my description was understandable, and I hope even more that someone has a solution for my problem.

Best regards,

derelektrischemoench

Link to post
Share on other sites

@derelektrischemoench,

Welcome to the forums. It works fine for me, both for 'included' (natural PW) children and native (MenuBuilder) children. Are you certain that your current class 'active' is not being applied as opposed to applied but overridden by another CSS class (e.g. 'last') via CSS Specificity/Cascade? Alternatively, can you confirm you are passing your $options properly to render() ?


@all....

I haven't forgotten pending requests/issues...I'm just currently swamped with other stuff. I hope to address concerns soon. Thanks for your patience.

Link to post
Share on other sites

@derelektrischemoench,

Welcome to the forums. It works fine for me, both for 'included' (natural PW) children and native (MenuBuilder) children. Are you certain that your current class 'active' is not being applied as opposed to applied but overridden by another CSS class (e.g. 'last') via CSS Specificity/Cascade? Alternatively, can you confirm you are passing your $options properly to render() ?

@all....

I haven't forgotten pending requests/issues...I'm just currently swamped with other stuff. I hope to address concerns soon. Thanks for your patience.

Hi Kongondo,

so I reviewed my css (it's not that much so far), and  I didn't find the use of the class "active" or anything comparable that would mess this stuff up further down the cascade, but I guess that's not the problem here. If I inspect my code and select a child item from my menu, the script simply doesn't apply the class "active", meaning the output markup stays completely the same.

This is the code that generates my menu so far:

<?php 

         $options = array(

                'wrapper_list_type' => 'ul',//ul, ol, nav, div, etc.
                'list_type' => 'li',//li, a, span, etc.
                'menu_css_id' => 'nav',//a CSS ID for the menu
                'menu_css_class' => 'drop',//a CSS Class for the menu
                'submenu_css_class' => 'submenu',//CSS Class for sub-menus
                'has_children_class' => 'menu_child',//CSS Class for any menu item that has children
                'first_class'=>'menu_top',//CSS Class for the first item in 
                'last_class' => 'menu_bottom',
                'current_class' => 'active',
                'current_class_level' => 2,//how high up the ancestral tree to apply 'current_class'
                'default_title' => 0,//0=show saved titles;1=show actual/current titles
                'include_children' => 4,//show 'natural' MB non-native descendant items as part of navigation
                'm_max_level' => 2,//how deep to fetch 'include_children'
                
                );           

            $menu = $modules->get("MarkupMenuBuilder");
             //load the module
            echo $menu->render('nav', $options);

           

        ?>

so from my understanding the line 'current_class' => 'active' should assign the class "active" to the currently selected/active menu item, which would then enable me  to adress this class via css, correct?

Unfortunately this class assignment doesn't take place :(

Perhaps I got some of the code generating the menu wrong, I'm relatively new to programming and have yet to overcome sucking at it, so feel free to correct me   :-)

Thx so far

derelektrischemoench

//edit: Solved it myself. The problem was that I didn't set my "home" page as the parent of the menu tree, I assumed current_class_level somehow magically recognized the site tree and applied .active to parent items. Which, of course, it didn't.

Thx nevertheless, sry for wasting time by being stupid :D

Link to post
Share on other sites

ProcessWire n00b here, be gentle!

Building my first ProcessWire site and one of the first problems I am running into is the menu system. Don't understand the logic in not having some kind of menu/nav builder in the Admin. Luckily I came across MenuBuilder!! So very simple to install and setup, thanks!

My site is based on BootStrap 3 and I am not finding enough "options" in the Menu Builder setup to get it working correctly. Hoping some one can point my in the right direction or a quick fix to the code could be done? Below is the correct code. I have hightlighted the pieces I can't figure out how to do with Menu Builder.

Edit: Apparently you can't highlight in the code block... Here's the bits in the top level menu item that has drop downs I need to add to the < a >:

  • class='dropdown-toggle'
  • data-toggle='dropdown'
  • <b class="caret"></b>

Any assistance is appreciated!

<ul class="nav navbar-nav navbar-right">
<li class='current'><a href='/'>Home</a></li>
<li class='dropdown'><a class='dropdown-toggle' href='/about/' data-toggle='dropdown' title='About'>About <b class="caret"></b></a>
<ul class='dropdown-menu'>
<li><a class='' href='/about/what/'  title='Child page example 1'>Child page example 1 </a></li>
<li><a class='' href='/about/background/'  title='Child page example 2'>Child page example 2 </a></li>
</ul>
</li>
<li><a class='' href='/site-map/'  title='Site Map'>Site Map </a></li>
</ul>
Link to post
Share on other sites

Looks like I was able to figure out a slight code tweak. Not sure if this is something that should make it's way into the official code or not (or if it is too 'hacky' to be of use to everyone):

Replace (around line 349 in the MarkupMenuBuilder.module):

//if $iTag is empty, apply css id and classes to <a> instead
if(!$iTag) $out .= "\n\t<a{$itemCSSID} {$class}{$newtab} href='{$m->url}'>{$m->title}</a>";
else $out .= "\n\t<{$iTag}{$itemCSSID}{$class}>\n\t\t<a{$newtab} href='{$m->url}'>{$m->title}</a>";

With:

//Bootstrap A tag edits
if($m->isParent && $o->bootstrap) {
$itemHasChildrenLink = ' data-toggle="dropdown" class="dropdown-toggle"';
$itemHasChildCaret = ' <span class="caret"></span>';
}
else {
$itemHasChildrenLink = '';
$itemHasChildCaret = '';
}

//if $iTag is empty, apply css id and classes to <a> instead
if(!$iTag) $out .= "\n\t<a{$itemCSSID} {$class}{$newtab}{$itemHasChildrenLink} href='{$m->url}'>{$m->title}{$itemHasChildCaret}</a>";
else $out .= "\n\t<{$iTag}{$itemCSSID}{$class}>\n\t\t<a{$newtab}{$itemHasChildrenLink} href='{$m->url}'>{$m->title}{$itemHasChildCaret}</a>";

Then add @ line 977 to create a new option:

$this->set('bootstrap', isset($options['bootstrap_menu']) ? $options['bootstrap_menu'] : 0);
Where:
bootstrap  //Test for bootstrap style menus - 1 = Yes / 0 = No [default]
Link to post
Share on other sites

Hi.

I get this error when saving menu items. The problem only arises when language support installed.

Error: Call to a member function getLanguageValue() on a non-object (line 1750 of /Users/vayu/Sites/processshop.dev/site/modules/ProcessMenuBuilder/ProcessMenuBuilder.module) 
This error message was shown because you are logged in as a Superuser. Error has been logged.

I have tested this on a clean install of Processwire version 2.6.1.

  • Like 1
Link to post
Share on other sites

Hi.

I get this error when saving menu items. The problem only arises when language support installed.

Error: Call to a member function getLanguageValue() on a non-object (line 1750 of /Users/vayu/Sites/processshop.dev/site/modules/ProcessMenuBuilder/ProcessMenuBuilder.module) 
This error message was shown because you are logged in as a Superuser. Error has been logged.

I have tested this on a clean install of Processwire version 2.6.1.

I had already reported this issue on Github, where I posted a problem-solution that works. Hope it helps. https://github.com/kongondo/MenuBuilder/issues/22

David

  • Like 4
Link to post
Share on other sites
  • 2 weeks later...

If I was to put a static/hardcoded <li></li> into a Menu Builder menu, how would I best approach a solution? Is there a way to have no wrapper_list_type, or echo my additional <li></li> together with $out?

I guess my problem could be solved with Hanna Code, but the question still intrigue me.

Here's my current code, for reference. With two <ul>s that I am trying to merge into one.

<?php if($user->isSuperuser()) : ?>
<ul>
  <li><a href='<?php echo $page->editURL; ?>'><i class='fa fa-pencil'></i> <?php echo __('Rediger', '/site/templates/header.inc'); ?></a></li>
  <li><a href='<?php echo $config->urls->admin; ?>'><i class='fa fa-gears'></i> <?php echo __('Kontrollpanel', '/site/templates/header.inc'); ?></a></li>
</ul>
<?php 
$adminmenu = 'administrator-menu';
$options = array( 'wrapper_list_type' => 'ul', 'list_type' => 'li');
$menu = $modules->get('MarkupMenuBuilder');
$out = $menu->render($adminmenu, $options);
echo $out;
?>
<?php endif; ?>
Link to post
Share on other sites
  • 1 month later...

Hey @kongondo,

I love this module and I'm featuring it in a comparison to WordPress's menu builder in my screencast series, however I feel there could be some general UI/UX improvements that can really make it feel more "native" and simplify what I feel is option overload.  Please take this as constructive criticism.

Here are my thoughts:

  1. Perhaps remove the ability to create multiple menus.  It's a nice feature but it feels like overkill since sites typically don't have more than just a few menus.  (or disable this option by default and perhaps have it enabled in the module's settings for advanced used).  Perhaps add a standard "Add New" button instead that follows the typical Page creation process.
  2. For the same reasons above, remove batch actions to delete, unpublish, etc.  (or disable this option by default and perhaps have it enabled in the module's settings for advanced used).
  3. When going in to edit a menu, make the first tab be "Structure" which is selected by default.  This is typically the first action most people would want to take so it would feel more natural for it to be the first tab item. There should be 3 fieldsets/sections in this "Structure" tab:
    1. Add Page
    2. Add Custom Link
    3. Menu Items
  4. Perhaps simplify how you can add pages to your menu:
    1. Remove the existing 3 methods: Pages (both ASM and PageAutoComplete), Custom, Selector
      1. In regards to adding pages using Selectors, perhaps have this disabled by default, but an option that can be enabled in the modules settings.  It's an advanced feature but I'd imagine wouldn't be as commonly used and therefore feels a bit overwhelming.
    2. If possible, replace with a ProcessPageList (this is what goes inside the "Add Page" fieldset).  It feels like a more natural fieldtype since it uses the tree.
      1. since this would replace the ASM way of adding menu items, that means you can't change a CSS Class/ID until AFTER it's been added to the menu.  I think that's OK since right now you change CSS Classes/IDs both before and after adding the menu item, which I find a little confusing.
    3. If possible, upon clicking a page to add to your menu on the ProcessPageList, it should show an "add" action/button (native ProcessPageList action stuff), that when clicked, adds the page to the actual menu (some ajax/dom manipulation required here I think) instead of putting it in a "limbo" state like it is right now until a page is saved.
    4. As far as being able to add custom links, that should go under the "Add Custom Link" fieldset.  Perhaps also remove batch ability to add Custom Links and utilize general Inputfieldtext instead of a table structure.  Remove ability to set CSS Class and ID at this stage.
  5. Now for the "Menu Items" section:
    1. Right now, you're utilizing custom styling and javascript for the adding page items and creating the toggle boxes, however it should be possible to use make each added menu item act as an InputfieldFieldset.  When each item/fieldset is clicked, it should reveal the 5 editable fields (Title, URL, CSS ID, Class Class, New Window) and ability to delete.  Apply the nestedSortable JS to that list to make it have drag/drop capability with indenting.  A final result similar to this screenshot which I hacked together.
  6. "Main" tab should be renamed to "Settings".  Put as second tab.
  7. "Items Overview" tab: this could be removed (or disabled by default) since it's essentially just displaying the same menu in a table.  Feels repetitive.
  8. "Delete" tab should remain as is.

What do you think?

  • Like 2
Link to post
Share on other sites

Hi,

thanks for the module, I think this is a great addition!

Is there a way to set default classes for the menu's li items and possible for the included a tags as well?

To keep nesting flat in the css, our stylesheet uses ".list-item" and ".list-item-link" classes.

And, would it be possible to set via the $options to not include the outermost "ul"? this would take care for instances like laban describes above (https://processwire.com/talk/topic/4451-menu-builder/page-6#entry97178) or my use case, where I'd like to add a "login / logout" nav item to the footer-menu - depending on the logged in state of the user this is either /login or /logout. I would add this in the template, not as an item via the menu builder, but it still needs to be enclosed in the "ul" wrap of the rendered menu.

Or would those two use cases be better taken care of if I used the JSON -> array() thing, just taking the infos provided by the menu builder and creating my own markup around it?

Anyways, great work, really looking forward to use this in a production site :-)

Link to post
Share on other sites

WOW! Just to answer myself; all of the above can easily be covered. Just don't use the render(); method.

Step 1: fetch your menu data and store it in an array:

$footermenu_items_json =  $pages->get('name=footer-menu')->menu_items; // this is the menu page in menu builder, could also be fetched with the ID
$footermenu_items = json_decode($footermenu_items_json, true);

Step 2: use that array to build your custom markup:

if( count($footermenu_items) > 0 ){
  $out = '<ul class="nav-list">';
  foreach($footermenu_items as $item){
    $url = ($item['url']) ? $item['url'] : $pages->get($item['pages_id'])->url;
    $target = (1 == $item['newtab']) ? 'target="_blank"':'';
    $out .= '<li class="list-item"><a href="' . $url . '" class="list-item-link" ' . $target . '>' . $item['title'] . '</a></li>';
  }
  if( $user->isLoggedin() ){
    $out .= '<li class="list-item"><a href="' . $pages->get('name=login, template=login')->url . 'logout/' . '" class="list-item-link">Logout</a></li>';
  } else {
    $out .= '<li class="list-item"><a href="' . $pages->get('name=login, template=login')->url . '" class="list-item-link">Login</a></li>';
  }
  $out .= '</ul>';
  echo $out;
}

Just make sure to var_dump the array somewhere to get an idea of what info is stored in there for the nested levels, etc.

This is really neat. For me it's the best of both worlds - I can easily create and maintain menus in the backend, but can still fully control the output in the template. Thank you!!

cheers,
Tom

  • Like 4
Link to post
Share on other sites
  • 4 weeks later...

@all,

Again, this is just a quick holding post....I am still tied up and cannot presently address your issues. 

@jonathan...thanks for taking the time to review the UI of the module. I hope to respond to your thoughts/suggestions soon.

Thank you all for your patience... :)

Link to post
Share on other sites
  • 2 weeks later...

Hi! Thanks for the great module!

After deciding that its functionality was a bit too much for what I wanted to do right now, I tried to uninstall the module but it throws this error: 

Can't delete template 'menus' because it is used by 1 pages.

The Markup Module unisntalls just fine.

 I am using PW 2.6.1

Thanks for further assistance,

Link to post
Share on other sites
  • 3 weeks later...

Looks like I was able to figure out a slight code tweak. Not sure if this is something that should make it's way into the official code or not (or if it is too 'hacky' to be of use to everyone):

Replace (around line 349 in the MarkupMenuBuilder.module):

//if $iTag is empty, apply css id and classes to <a> instead
if(!$iTag) $out .= "\n\t<a{$itemCSSID} {$class}{$newtab} href='{$m->url}'>{$m->title}</a>";
else $out .= "\n\t<{$iTag}{$itemCSSID}{$class}>\n\t\t<a{$newtab} href='{$m->url}'>{$m->title}</a>";

With:

//Bootstrap A tag edits
if($m->isParent && $o->bootstrap) {
$itemHasChildrenLink = ' data-toggle="dropdown" class="dropdown-toggle"';
$itemHasChildCaret = ' <span class="caret"></span>';
}
else {
$itemHasChildrenLink = '';
$itemHasChildCaret = '';
}

//if $iTag is empty, apply css id and classes to <a> instead
if(!$iTag) $out .= "\n\t<a{$itemCSSID} {$class}{$newtab}{$itemHasChildrenLink} href='{$m->url}'>{$m->title}{$itemHasChildCaret}</a>";
else $out .= "\n\t<{$iTag}{$itemCSSID}{$class}>\n\t\t<a{$newtab}{$itemHasChildrenLink} href='{$m->url}'>{$m->title}{$itemHasChildCaret}</a>";

Then add @ line 977 to create a new option:

$this->set('bootstrap', isset($options['bootstrap_menu']) ? $options['bootstrap_menu'] : 0);
Where:
bootstrap  //Test for bootstrap style menus - 1 = Yes / 0 = No [default]

Great work! Hacky but great! I'm also new to PW but I'm loving it so far.

My solution for using MenuBuilder with Bootstrap 3 is kinda hacky as well. No need to change the module code here but it's definitely some sloppy coding, like don't-try-this-at-home-sloppy.

Configure the options like so:

$options = array(
           'wrapper_list_type'  => 'ul',
           'menu_css_class'     => 'nav navbar-nav',
           'submenu_css_class'  => 'dropdown-menu',
           'has_children_class' => 'dropdown',
);

And do the rest with jQuery: (the sloppy part)

$(document).ready(function () {
       $(".dropdown [href='#']:first-child").attr("data-toggle", "dropdown").addClass('dropdown-toggle');
});

I know the the dropdowns are selected with [href=#] (which is horrible). I did that because reasons. It works. And it took only 30 minutes to figure out. That proofs how awesome this module is!

Link to post
Share on other sites
  • 1 month later...

I had already reported this issue on Github, where I posted a problem-solution that works. Hope it helps. https://github.com/kongondo/MenuBuilder/issues/22

David

@David and other experiencing this issue. I have not been able to replicate the issue. Please see my comment on the issue at Github. Could someone please provide responses to the questions I have detailed there? Thanks.

Link to post
Share on other sites
  • 1 month later...

Hi all!

I am new to PW and I am using the module MenuBuilder just for creating the menu of my web site, but I have a problem when I swicth language from English to another; in fact when I switch to Italian language for example, the menu does not appear and sometimes an error appears ("Error: No menu items found"). I would like to ask if somebody knows how to create a multilanguage menu by means of Menu Builder and if yes, can show me how to do it.

Thanks in advance

Link to post
Share on other sites

Hi @Mattia90,

Welcome to ProcessWire and the forums. Sorry about the problems you are encountering with MenuBuilder. I am the author of the module. To be honest, I know next to nothing about multilingual setups. I don't know how to add or remove a language or how to specify a default language nor about the various approaches to setting up a multilingual site :-). However, I have tested MenuBuilder with the default ProcessWire multilingual install and it works fine. Other guys have had issues with MenuBuilder after they'd removed a language. I have not been able to reproduce some of the issues. So, unless someone can give me a 'dummies' step-by-step instruction on how to reproduce their multilingual error/bug, I have no way of fixing the issues :(.

Link to post
Share on other sites

Hi @kongondo!

Thank you for your reply. Now I explain in a detailed way what I did:

1) My idea was to create a web site both in English and in Italian and in order to do this, according to the official documentation of ProcessWire, I installed all the modules that you can find under the voice "Language" (Language Support) : in the admin page, Modules -> Core;

2) I have created a menu by means of admin page: Setup -> Menu Builder and here I created a menu with title "Menu_X" and then I built the menu by adding the pages that I wanted.

3) In order to have this web site in Italian and in English, in order to have the possibility to switch from one language to the other one, I added in each page this piece of code taken from the official documentation of ProcessWire:

$menu = $modules->get("MarkupMenuBuilder"); //load the module
 
$options = array(
         'wrapper_list_type' => 'ul',
         'list_type' => 'li',
         'menu_css_id' => '',
         'menu_css_class' => 'nav navbar-nav',
         'submenu_css_class' => 'hvr-bounce-to-bottom',
         'current_class' => 'active',
         'current_css_id' => '',
         'divider' => '»',// e.g. Home >> About Us >> Leadership
         //prepend home page at the as topmost item even if it isn't part of the breadcrumb
         'prepend_home' => 0,//=> 0=no;1=yes
         'default_title' => 0,//0=show saved titles;1=show actual/current titles
         'include_children' => 4,//show 'natural' MB non-native descendant items as part of navigation
         'b_max_level' => 1,//how deep to fetch 'include_children'
);
 
echo $menu->render('Menu_X', $options); //render the menu

This is a select that allows to switch from English to Italian and viceversa.

4) Now when I created the "Menu_X", there wasn't the possibility to specify the titles of the different menu items in both languages and also the different urls: in fact the menu works only in the default language (English); what it seems strange is that when I switch from English to Italian, this error appears: "Fatal error: Exception: No menu items found! Confirm that such a menu exists and that it has menu items."

In the worst case, what I expected is to have the same menu both in Italian and in English. I would like to have how to create a multilingual menu with the right urls by means of Menu Builder.

Thanks in advance.

Edited by kongondo
wrapped code in code block
Link to post
Share on other sites

Hi @Mattia90

Apologies for the delay in getting back to you. I don't know about your setup there but MenuBuilder should work out of the box with a Multi-lingual site except for this one issue reported here include a possible fix which I am yet to implement. Does that fix help in your case? MenuBuilder will read and load the correct language of the user. No need to specify titles for each language when building the menu. 

What do you mean by: 

 This is a select that allows to switch from English to Italian and viceversa.

Is Menu_X the title of the menu you created?

Does your site work normally otherwise?, i.e. without MenuBuilder? Like I said, I have tested it with ProcessWire's site-languages and it works fine (with three languages). 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By FireWire
      Hello community!

      I want to share a new module I've been working on that I think could be a big boost for multi-language ProcessWire sites.

      Some background, I was looking for a way for our company website to be efficiently translated as working with human translators was pretty laborious and a lack of updating content created a divergence between languages. I, and several other devs here, have talked about translation integrations and have recognized the power that DeepL has. DeepL is an AI deep learning powered service that delivers translation quality beyond any automated service available. After access to the API was opened up to the US, I built Fluency, a DeepL translation integration for ProcessWire.
      Fluency brings automated translation to every multi-language field in the admin, and also provides a translation tool allowing the user to translate their text to any language without it being inside a template's field. With Fluency you can:
      Translate any plain textarea or text input Translate any CKEditor content (yes, with markup) Translate page names for fully localized URLs on every page Translate your in-template translation function wrapped strings Translate modules Fluency is free, and now so is DeepL
      Since this module was first built DeepL has introduced free Developer accounts that allow anyone to start using Fluency at zero cost and beginning with the version 0.3.0 release Fluency now supports free DeepL accounts. As of June 2021 DeepL supports translation to 26 languages and continues to offer more!
      Installation and usage is completely plug and play. Whether you're building a new multi-language site, need to update a site to multi-language, or simply want to stop manually translating a site and make any language a one-click deal, it could not be easier to do it. Fluency works by having you match the languages configured in ProcessWIre to DeepL's. You can have your site translating to any or all of the languages DeepL translates to in minutes (quite literally).
      Let's break out the screenshots...
      When the default language tab is shown, a message is displayed to let users know that translation is available. Clicking on each tab shows a link that says "Translate from English". Clicking it shows an animated overlay with the word "Translating..." cycling through each language and a light gradient shift. Have a CKEditor field? All good. Fluency will translated it and use DeepL's ability to translate text within HTML tags. CKEditor fields can be translated as easily and accurately as text/textarea fields.

      Repeaters and AJAX created fields also have translation enabled thanks to a JavaScript MutationObserver that searches for multi-language fields and adds translation as they're inserted into the DOM. If there's a multi-language field on the page, it will have translation added.

      Same goes for image description fields. Multi-language SEO friendly images are good to go.

      Creating a new page from one of your templates? Translate your title, and also translate your page name for native language URLs. (Not available for Russian, Chinese, or Japanese languages due to URL limitations). These can be changed in the "Settings" tab for any page as well so whether you're translating new pages or existing pages, you control the URLs everywhere.

      Language configuration pages are no different. Translate the names of your languages and search for both Site Translation Files (including all of your modules)

      Translate all of the static text in your templates as well. Notice that the placeholders are retained. DeepL is pretty good at recognizing and keeping non-translatable strings like that. If it is changed, it's easy to fix manually.

      Fluency adds a "Translate" item to the CMS header. When clicked this opens up a modal with a full translation tool that lets the user translate any language to any language. No need to leave the admin if you need to translate content from a secondary language back to the default ProcessWire language. There is also a button to get the current API usage statistics. DeepL account owners can set billing limitations via character count to control costs. This may help larger sites or sites being retrofitted keep an eye on their usage. Fluency can be used by users having roles given the fluency-translate permission.

      It couldn't be easier to add Fluency to your new or existing website. Simply add your API key and you're shown what languages are currently available for translation from/to as provided by DeepL. This list and all configuration options are taken live from the API so when DeepL releases new languages you can add them to your site without any work. No module updates, just an easy configuration. Just match the language you configured in ProcessWire to the DeepL language you want it to be associated with and you're done. Fluency also allows you to create a list of words/phrases that will not be translated which can prevent items such as brands and company names from being translated when they shouldn't

       
      Limitations:
      No "translate page" - Translating multiple fields can be done by clicking multiple translation links on multiple fields at once but engineering a "one click page translate" is not feasible from a user experience standpoint. The time it takes to translate one field can be a second or two, but cumulatively that may take much longer (CKEditor fields are slower than plain text fields). There may be a workaround in the future but it isn't currently on the roadmap. No "translate site" - Same thing goes for translating an entire website at once. It would be great, but it would be a very intense process and take a very (very) long time. There may be a workaround in the future but it isn't on the roadmap. No current support for Inline CKEditor fields - Handling for CKEditor on-demand hasn't been implemented yet, this is planned for a future release though and can be done. I just forgot about it because I've never really used that feature personally.. Alpha release - This module is in alpha. Releases should be stable and usable, but there may be edge case issues. Test the module thoroughly and please report any bugs via a Github issue on the repository or respond here. Please note that the browser plugin for Grammarly conflicts with Fluency (as it does with many web applications). To address this issue it is recommended that you disable Grammarly when using Fluency, or open the admin to edit pages in a private window where Grammarly may not be loaded. This is an issue that may not have a resolution as creating a workaround may not be possible. If you have insight as to how this may be solved please visit the Github page and file a bugfix ticket.
      Requirements:
      ProcessWire  3.0+ UIKit Admin Theme That's Fluency in a nutshell. A core effort in this module is to create it so that there is nothing DeepL related hard-coded in that would require updating it when DeepL offers new languages. I would like this to be a future-friendly module that doesn't require developer work to keep it up-to-date.
      The Module Is Free
      This is my first real module and I want to give it back to the community as thanks. This is the best CMS I've worked with (thank you Ryan & contributors) and a great community (thank you dear reader).
      DeepL Developer Accounts
      In addition to paid Pro Developer accounts, DeepL now offers no-cost free accounts. Now all ProcessWire developers and users can use Fluency at no cost.
      Learn more about free and paid accounts by visiting the DeepL website. Sign up for a Developer account, get an API key, and start using Fluency today.
      Download & Feedback
      Download the latest version here
      https://github.com/SkyLundy/Fluency-Translation/archive/main.zip
      Github repository:
      https://github.com/SkyLundy/Fluency-Translation
      File issues and feature requests here (your feedback and testing is greatly appreciated):
      https://github.com/SkyLundy/Fluency-Translation/issues
       
      Thank you! ¡Gracias! Ich danke Ihnen! Merci! Obrigado! Grazie! Dank u wel! Dziękuję! Спасибо! ありがとうございます! 谢谢你!

    • By monollonom
      (once again I was surprised to see a work of mine pop up in the newsletter, this time without even listing the module on PW modules website 😅. Thx @teppo !)
      Github: https://github.com/romaincazier/FieldtypeQRCode
      Modules directory: https://processwire.com/modules/fieldtype-qrcode/
      This is a simple module I made so a client could quickly grab a QR Code of the page's url in the admin.
      There's not much to it for now, but if need be you can output anything using a hook:
      $wire->addHookAfter("FieldtypeQRCode::getQRText", function($event) { $event->return = "Your custom text"; }) You can also output the QR code on your front-end by calling the field:
      echo $page->qr_code_field; The module uses the PHP library QR Code Generator by Kazuhiko Arase. When looking for a way to generate a QR Code in PW I came across @ryan's integration in his TFA module. I'm not very familiar with fieldtype/inputfield module development so I blindly followed @bernhard (great) tutorial and his BaseFieldtypeRuntime. At some point I'll take a deeper look to make a module on my own.
      Some ideas for improvements :
      add the ability to choose what to ouput : page's url / editUrl / file(s) / image(s) / ... allow to output multiple QR codes ?
    • By Chris Bennett
      https://github.com/chrisbennett-Bene/AdminThemeTweaker
      Inspired by @bernhard's excellent work on the new customisable LESS CSS getting rolled into the core soon, I thought I would offer up the module for beta testing, if it is of interest to anyone.

      It takes a different approach to admin styling, basically using the Cascade part of CSS to over-ride default UiKit values.
      Values are stored in ModuleConfig Module creates a separate AdminThemeTweaker Folder at root, so it can link to AdminThemeTweaker.php as CSS AdminThemeTweaker.php reads the module values, constructs the CSS variables then includes the CSS framework Can be switched on and off with a click. Uninstall removes everything, thanks to bernhard's wonderful remove dir & contents function.
      It won't touch your core. It won't care if stuff is upgraded. You won't need to compile anything and you don't need to touch CSS unless you want to.

      It won't do much at all apart from read some values from your module config, work out the right CSS variables to use (auto contrast based on selected backgrounds) and throw it on your screen.
      You can configure a lot of stuff, leave it as it comes (dark and curvy), change two main colors (background and content background) or delve deep to configure custom margins, height of mastheads, and all manner of silly stuff I never use.

      Have been developing it for somewhere around 2 years now. It has been (and will continue to be) constantly tweaked over that time, as I click on something and find something else to do.
      That said, it is pretty solid and has been in constant use as my sole Admin styling option for all of those 2 years.

      If nothing else, it would be great if it can provide any assistance to @bernhard or other contributor's who may be looking to solve some of the quirkier UiKit behavior.
      Has (in my opinion) more robust and predictable handling of hidden Inputfields, data-colwidths and showIf wrappers.
      I am very keen to help out with that stuff in any way I can, though LESS (and any css frameworks/tools basically) are not my go.
      I love CSS variables and banging-rocks-together, no-dependency CSS you can write with notepad.



       

    • By opalepatrick
      I see old posts saying that repeaters are not the way to go in Custom Process Modules. If that is the case, when using forms (as I am trying to do) how would one tackle things like repeat contact fields where there can be multiple requirements for contact details with different parameters? (Like point of contact, director, etc) or even telephone numbers that have different uses?
      Just for background I am creating a process module that allows me to create types of financial applications in the admin area (no need to publish any of this, pure admin) that require a lot of personal or company information.
      Maybe I am thinking about this incorrectly?
    • By HMCB
      I ran across a reference to IftRunner module. The post was 6 years ago. I cant find it in available modules. Has it been pulled?
×
×
  • Create New...