Mats

Module: Leaflet Map

Recommended Posts

@Juergen In leaflet JS there is a method invalidateSize() which checks if the size of the map container has changed and then updates the map.

When you call the UIKit modal, the size of the map container changes and therefore your map needs to be updated manually.

So you need to listen to the show.uk.modal event and attach a handler that updates the leaflet map.

The problem here is that the map object is not easily accessible from the global document scope because the JS that renders the map is executed inside an anonymous function call.

You should find a script like this just before the closing </body> tag:

<script type="text/javascript">
 $(function() {
var mleafletmap1 = new jsMarkupLeafletMap();
mleafletmap1.setOption('zoom', 18);

mleafletmap1.init('mleafletmap1', 49.572056, 10.878165, 'OpenStreetMap.Mapnik');
var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'home', iconColor: 'white', prefix: 'fa', markerColor: 'darkblue' });
mleafletmap1.addMarkerIcon(default_marker_icon, 49.572056, 10.878165, '/maptest/', 'maptest', '');
});
</script>

So if you try and get the map object with $(mleafletmap1), this will not return what you need.

In order to have the map object available in global scope, you need to change some module code. You can find the changes at my fork in MarkupLeafletMap.module. Just copy this over your local file.

Now the script before the closing </body> tag should look something like this:

<script type="text/javascript">
var mymap;
 $(function() {
var mleafletmap1 = new jsMarkupLeafletMap();
mleafletmap1.setOption('zoom', 18);

mleafletmap1.init('mleafletmap1', 49.572056, 10.878165, 'OpenStreetMap.Mapnik');
var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'home', iconColor: 'white', prefix: 'fa', markerColor: 'darkblue' });
mleafletmap1.addMarkerIcon(default_marker_icon, 49.572056, 10.878165, '/maptest/', 'maptest', '');
mymap = mleafletmap1;
});
</script>

And you can now access the map object in your script with mymap.map. Example code:

<script>
	var myModal = $('#yourmodalID');
	mymodal.on('show.uk.modal', function(){
		mymap.map.invalidateSize(true);
	})
</script>

While this is just a workaround it should help to display the map correctly.

@Mats Maybe we should add something like this to the module code so in future versions a map object will be returned by default? Or do you see another way to access the map object with the module as is?

  • Like 2

Share this post


Link to post
Share on other sites

Thanks @gebeer

but after replacing the MarkupLeafletMap.module file with your version, the map will be not rendered at all. So its not a big problem. I can view the map without modal too. A code modification is not what I want.  But thousand thanks for your efforts.

Best regards

Share this post


Link to post
Share on other sites

@gebeer

I tested it on the V3 version and changed the content of the files as suggested. The map in the screen stays blank and the consoles says:

==> jquery.min.js:2:31515
jQuery.Deferred exception: t is undefined o.Util.trim@https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:1149
o.Util.splitWords@https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:1230
o.Evented<.on@https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:3878
L.MarkerClusterGroup<.initialize@http://durvenleven.be/pw/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster/leaflet.markercluster.js:6:515
o.Class.extend/e@https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:2729
jsMarkupLeafletMap@http://durvenleven.be/pw/site/modules/FieldtypeLeafletMapMarker/MarkupLeafletMap.js:54:19
@http://durvenleven.be/pw/straatnamen/abraham-hansplein/:36:20
g/</j@https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:29946
g/</k<@https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:30262
 undefined

                                                                                
==> TypeError: t is undefined[Meer info]  leaflet.js:5:1149
	o.Util.trim https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:1149
	o.Util.splitWords https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:1230
	o.Evented<.on https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:3878
	L.MarkerClusterGroup<.initialize http://durvenleven.be/pw/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster/leaflet.markercluster.js:6:515
	o.Class.extend/e https://unpkg.com/leaflet@1.0.3/dist/leaflet.js:5:2729
	jsMarkupLeafletMap http://durvenleven.be/pw/site/modules/FieldtypeLeafletMapMarker/MarkupLeafletMap.js:54:19
	<anoniem> http://durvenleven.be/pw/straatnamen/abraham-hansplein/:36:20
	g/</j https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:29946
	g/</k< https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js:2:30262

In InputfieldLeafletMapMarker.module - Lines 61 and 64 I also bumbed the version to 1.0.3 for the admin side and there the 'map' is working fine. (rendering-georeferring, saving etc) 

Share this post


Link to post
Share on other sites

@Pretobrazza Did you also update the leaflet-markercluster files?

Because the inputfield map is not using the marker cluster plugin.

  • Like 1

Share this post


Link to post
Share on other sites

@gebeer

I replaced/added  the content of these files in /pw/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster

MarkerCluster.Default.css    add oldie styles     3 years ago
MarkerCluster.css    Corrected spiderfy leg anim and leg opacity option     2 years ago
leaflet.markercluster-src.js    Tag v1.0.4     29 days ago
leaflet.markercluster.js    Tag v1.0.4     29 days ago

EDIT: IT IS WORKING !! Thank you very much @gebeer

setup: PW 3.0.58 © 2017  Leaflet 1.0.3 with modified files as above is FieldtypeLeafletMapMarker/assets/leaflet-markercluster

Edited by Pretobrazza
Clarity for future readers having similar problem

Share this post


Link to post
Share on other sites

@Pretobrazza It might be related to the jQuery version you are using. 1.11.0 is a bit outdated. You might want to try a newer one. My map is rendering fine on 2.2.4

Share this post


Link to post
Share on other sites

Hello @gebeer

11 hours ago, gebeer said:

@Pretobrazza It might be related to the jQuery version you are using. 1.11.0 is a bit outdated. You might want to try a newer one. My map is rendering fine on 2.2.4

Unless I'm missing something important about the version of jquery on my testing page I was using //ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js in the template file. Now I changed it to  //ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js and everything is fine with the map. The testing page takes a few seconds to load as There are 600+ pw children streets which will eventually be shown in the end ;) (look at the source). 

Next step for me to endeavor into :

I saw in the options of the leaflet-PW module, that one can control the behavior of  the `markerTitleField` (or alternatively markerLinkField) which means that a sliding pane or modal window would be triggered to load the content of a page. What do I put in there? Is it possible?

I'm looking around for a versatile Leaflet script (there are many it seems) to put content in a slider pane OR modal window, so that when someone clicks in the title link  in a popup or on a marker, instead of opening a new page, in the browser, a responsive page gets called up in a sliding pane or modal window inside the map with the possibility to have extra controls around them (eg. close, fullscreen, 'like', post a comment, mailto,  etc etc).  

.... but first finding the versatile sliding window (and/or modal) script to load any type of content into is already a challenge for me as I want to stick to the latest version of PW as well as of leaflet (1.0.3)  ...  Does anyone a suggestion?

Even though there is streetview in this example, I'm convinced that with the Leaflet Map module PW will render a page like this on it's socks, not so? 

(The next step after this will be even more of a challenge.to broaden the scope of this module even further)

Share this post


Link to post
Share on other sites
31 minutes ago, Pretobrazza said:

.... but first finding the versatile sliding window (and/or modal) script to load any type of content into is already a challenge for me as I want to stick to the latest version of PW as well as of leaflet (1.0.3)  ...  Does anyone a suggestion?

A dialog box, whether sliding or animated fade, doesn't have anything to do with ProcessWire. You can use Uikit, Bootstrap, or any other css framework to present that information.

 

Share this post


Link to post
Share on other sites

Thank you for your quick reply, but in the ### Options of the leaflet-PW module, can I control the behavior of  the `markerTitleField` (or alternatively markerLinkField) which means that the dialog box  would be triggered to load the content of a page. What do I put in the the `markerTitleField` (or alternatively 'markerLinkField')  option to do so? Is it possible? Does the corresponding .js or other file in the module provide for it?

19 minutes ago, rick said:

A dialog box, whether sliding or animated fade, doesn't have anything to do with ProcessWire. You can use Uikit, Bootstrap, or any other css framework to present that information

 

Share this post


Link to post
Share on other sites

I can't give specific details as I do not use this module. In theory, however:

You can load page content into a bootstrap (just an example) dialog box via an ajax request based on the user clicking the markerTitleField and then display that dialog box.

OR

Depending on the number of clickable markerTitleFields, you could pre-load hidden containers with the appropriate content and display the corresponding dialog box.

Maybe I'm not understanding the issue, which is likely. :)

Share this post


Link to post
Share on other sites

@rick

To call the map in the test page map I use:
 

<?php $options = array('markerIcon' => 'flag', 'markerColour' => 'purple', 'markerTitleField' => 'title',); 
  echo $map->render($page, 'map'); ?>

to zoom into my question in the options I find among many others::

`markerLinkField` | Page field to use for the marker link, or blank to not link (type: string; default: url)
`markerTitleField` | Page field to use for the marker title, or blank not to use a marker title (type: string; default: title)

I'm missing something like markerTitleLinkField whereby I could call a dialog box, am I right? 

Share this post


Link to post
Share on other sites

You wouldn't necessarily create another field just to provide a link. You can use jquery to locate the title field(s) and enclose the content within the desired anchor tag. 

But isn't that what the link field is for?

Share this post


Link to post
Share on other sites

@Pretobrazza with the options markerLinkField and markerTitleField you can pass field names. The content of those fields on your page will be used as title and url within the marker popup.

To apply the options you have to pass them to the render method

<?php $options = array('markerIcon' => 'flag', 'markerColour' => 'purple', 'markerTitleField' => 'title',); 
  echo $map->render($page, 'map', $options); ?>

If you want to have additional popup content you can use the option 'popupFormatter' which is documented in the Readme.md. You can pull any content from any page and put it in the 'popupFormatter' option's callback function.

 

 

Share this post


Link to post
Share on other sites

Hello everyone,
Hello @gebeer

After having tested lots of modal rendering scripts, for 3 solid days, I ended up with Featherlighta very lightweight jQuery lightbox plugin, which seems to harness many possibilities.

  1. From a 'Title' field in a Leaflet map popup, I can now render  child pages with a map in modal windows overlaying each other.  However now I need every map to get a different ID  instead of 'mleafletmap1' otherwise they won't render. I tried to put $page->name but as soon as there are hyphens, it doesn't work. Any idea of which dynamically generated variable I could use as an ID for the maps in the base-template?
  2. In the popover  the title has to be clicked twice to fire a modal page. How (where) can I change this behavior?
  3. Even though everything is working fine inside the map, at the bottom of the modal windows with a map I find this:
$(function() { var percelen = new jsMarkupLeafletMap(); percelen.setOption('zoom', 14); percelen.setOption('scrollWheelZoom', 1); percelen.init('percelen', 51.341845581086325, 3.268561363220215, 'OpenStreetMap.Mapnik'); var default_marker_icon = L.AwesomeMarkers.icon({ icon: 'home', iconColor: 'white', prefix: 'fa', markerColor: 'green' }); });

(in a map with markers this gets much longer)

Is it an error that this appears under each modal map or is it something I will have to look into on the side of Featherlight?

In any case, at least I'm moving on now and as soon as the problems above can be solved (especially the first 2), I will start playing around with basemaps  and wms and see what happens ... 

Share this post


Link to post
Share on other sites

Hello,

I managed to render a leaflet map with wms in a barebone template in processwire.

Seen that it works, I added a new provider in leaflet-providers.js and I also updated providers.inc and providers.json files.

In leaflet-providers.js  I added:

		.......
		}, <--- didnt forget the comma ;)
		GRB: {
			url: 'https://geoservices.informatievlaanderen.be/raadpleegdiensten/GRB/wms?',
			options: {
				layers: 'GRB_BSK',
				format: 'image/png',
				transparent: true,
				attribution: 'Realized on Processwire'
			}
		}

As a proof of concept first, in order to render the map I must replace the L.tileLayer by L.tileLayer.wms somewhere in the script so that I can obtain a:

whatever = L.tileLayer.wms("https://geoservices.informatievlaanderen.be/raadpleegdiensten/GRB/wms?", {
            layers: 'GRB_BSK',
            format: 'image/png',
            transparent: true,
            attribution: "Realised on Processwire"
        }).addTo(map);

After a hint from @gebeerI tried to do so  in MarkupLeafletMap.js line 47. but I don't think I'm doing it right.  

Is there a particular syntax I should use?

Share this post


Link to post
Share on other sites

Could you consider setting scrollWheelZoom: false as option for the backend?

I inadvertently easily change carefully set zoom settings just by scrolling the edit-page with the Trackpad or mousewheel. :-)

Share this post


Link to post
Share on other sites

Hello,

Now I have come to the stage whereby I want to import hundreds of pages via CSV with addresses. 

I tried to find a solution in this forum via Google search and tried all the possibilities  that were suggested for Batch child editor  as well as in the code of the ImportPagesCSV module being used/suggested  for Ryans's MapMaker but both of them refuse to work and import the adresses, lat lng zoom in one way on another into the Leaflet mapfield.

Now I have 2 questions:

1. Is anyone succeeding at the moment to upload CSV's to the Leaflet Map addressfield?  How?   My version of PW is 3.0.61 - Leaflet V 1.03 - php 7.0. 

2. If so, here's my second question (to @gebeer,  I think?):     Say, I only upload the address, will it geocode automatically? If not can it be done or will I be to geocode the addresses externally beforehand before I upload the CSV's?

Kind regards,
Bernard   

Share this post


Link to post
Share on other sites

@Pretobrazza, I just tested CSV import of FieldtypeLeafletMapMarker fields with the ImportPagesCSV module and it works fine but needs a couple of simple modifications to the ImportPagesCSV module.

Add FieldtypeLeafletMapMarker to the array of allowed fieldtypes:

/**
 * List of Fieldtypes that we support importing to
 *
 */
protected $fieldtypes = array(
    'FieldtypePageTitle',
    'FieldtypeText',
    'FieldtypeTextarea',
    'FieldtypeInteger',
    'FieldtypeFloat',
    'FieldtypeEmail',
    'FieldtypeURL',
    'FieldtypeCheckbox',
    'FieldtypeFile',
    'FieldtypePage',
    'FieldtypeLeafletMapMarker',
    );

Tell the module how to handle the import of the FieldtypeLeafletMapMarker fieldtype:

/**
 * Assign a value to a page field 
 *
 */
protected function importPageValue(Page $page, $name, $value) {

    $field = $this->fields->get($name); 

    if($field->type instanceof FieldtypeFile) {

        $value = trim($value); 
        // split delimeted data to an array
        $value = preg_split('/[\r\n\t|]+/', $value); 
        if($field->maxFiles == 1) $value = array_shift($value);
        $data = $page->ImportPagesCSVData; 
        $data[$name] = $value; 
        $page->ImportPagesCSVData = $data; 

    } elseif($field->type instanceof FieldtypeLeafletMapMarker) {

        $value = trim($value);

        // If importing pipe-separated latitude and longitude values, e.g. "-46.0026999|168.03567"
        // list($lat,$lng) = explode('|', $value);
        // $page->$name->lat = $lat;
        // $page->$name->lng = $lng;

        // If importing address string (automatically geocoded on import)
        $page->$name->address = $value;

    } else {

        $page->set($name, $value); 
        if($name == 'title') $page->name = $this->sanitizer->pageName($value, 2); // Sanitizer::translate
    }
}

You'll see I added two ways to import the map pin location: lat/lng (commented out) or address. If you import an address string the lat and lng are geocoded automatically on import. If you import lat and lng without an address then the pin is placed at that location but no address string is automatically generated. If you were to import an address string and a lat/lng (not shown here and not recommended) then the lat/lng is ignored and the location is geocoded from the address string - i.e. the same as just importing an address string.

You could add a zoom value if you wanted - just separate from the other value(s) with a pipe and adapt the example for lat/lng, i.e. explode() and list().

Edited by Robin S
removed draft text

Share this post


Link to post
Share on other sites

Hello @Robin S,

Thank you for your reply!

Since yesterday I tried those combinations but to no avail. Just now I turned the php7 to 5.6 but there too it doesn't work for me.

In one of the existing pages I had already saved an address but after uploading 2 records with an address (with $page->$name->address = $value;) , that one too disappeared. Could it be pw 3.0.61  which causes an issue?

Tonight I tried with BCE too but there too  .. no success :(

Share this post


Link to post
Share on other sites

This morning I tried again and only found 1 error in JqueryCore.js:2:40351 ( /wire/modules/Jquery/JqueryCore):  Use of getPreventDefault() isn't supported anymore. Instead use: defaultPrevented.   ->  I did so and the error went away. 

On the other hand, when I try and drop a CSV in the the ImportPagesCSV upload box, it doesn't accept it, so I have to press the upload button. For normal fields an even pictures the the ImportPagesCSV module  is working fine but not for the Leaflet submaps.  Same problem with BCE.  

My version of PW is 3.0.61 - Leaflet V 1.03 - php 7.1  now

Share this post


Link to post
Share on other sites
On 4/11/2017 at 0:26 PM, Pretobrazza said:

@gebeer

I replaced/added  the content of these files in /pw/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster

MarkerCluster.Default.css    add oldie styles     3 years ago
MarkerCluster.css    Corrected spiderfy leg anim and leg opacity option     2 years ago
leaflet.markercluster-src.js    Tag v1.0.4     29 days ago
leaflet.markercluster.js    Tag v1.0.4     29 days ago

EDIT: IT IS WORKING !! Thank you very much @gebeer

setup: PW 3.0.58 © 2017  Leaflet 1.0.3 with modified files as above is FieldtypeLeafletMapMarker/assets/leaflet-markercluster

Hi,

I face a problem that at a first glance looks so as the above ... but is different. Having pw3.0.61, after upgrading LeafletMapMarker to the last version (2.8.1), the module stopped outputting the leaflet <script> tag with its content. The <div id='mleafletmap1' ...> with its options is present, both single and multiple (21) items/pages supplied tested (1st parameter).

Would anyone know where the issue comes from and how to correct it?

The rendered html is this:
 

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="/site/templates/scripts/jquery.js"></script>
    
    <!-- Leaflet --><link rel="stylesheet" type="text/css" href="/site/modules/FieldtypeLeafletMapMarker/assets/font-awesome-4.6.3/css/font-awesome.min.css">        <!-- Styles supporting the use of Leaflet.js -->
        <link rel="stylesheet" type="text/css" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
        <link rel="stylesheet" type="text/css" href="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster/MarkerCluster.css" />
        <link rel="stylesheet" type="text/css" href="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster/MarkerCluster.Default.css" />

        <!-- Scripts supporting the use of Leaflet.js -->
        <script type="text/javascript" src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
        <script type="text/javascript" src="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-markercluster/leaflet.markercluster.js"></script>
        <script type="text/javascript" src="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-providers/leaflet-providers.js"></script>
        <script type="text/javascript" src="/site/modules/FieldtypeLeafletMapMarker/MarkupLeafletMap.js"></script>

        <!-- Extend Leaflet with Awesome.Markers -->
        <link rel="stylesheet" type="text/css" href="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-awesome-markers/leaflet.awesome-markers.css" />
        <script type="text/javascript" src="/site/modules/FieldtypeLeafletMapMarker/assets/leaflet-awesome-markers/leaflet.awesome-markers.min.js"></script>
</head>
<body>
<div id='mleafletmap1' class='MarkupLeafletMap' style='width: 100%; height: 700px;'></div>
</body>
</html>

 

Edited by loukote
clarification

Share this post


Link to post
Share on other sites
On 5/10/2017 at 1:25 AM, loukote said:

[...] Would anyone know where the issue comes from and how to correct it? [...]

Hm, funny: the map appears when a user is logged in the back-end, does not appear otherwise. In MarkupLeafletMap.module (version 3.0.2) on line 231 the map <div> is output and the <script> is sent to the be hooked before the </body> end-tag just after that, lines 233 to 283. @gebeer, would there be anything suspicious in the MarkupAddInlineScript.module?

Share this post


Link to post
Share on other sites

@loukote I just checked on a 3.0.61 install with leaflet 2.8.1 and 3.0.2 and here it is working as expected, even if not logged in to the backend at the same time.

This could be a permission related issue. Do you have any access restriction set on the template that renders the map?

You can check the value of $page->inlineScript on the page that you output the map after the code that renders the map. If it has a value, then the script code should be prepended to the closing </body> tag.

Share this post


Link to post
Share on other sites
On 11/5/2017 at 10:15 PM, loukote said:

Hm, funny: the map appears when a user is logged in the back-end, does not appear otherwise.

For me the problem with the map either or not appearing on the front-end lied with the " Front-End Page Editor " module. When uninstalling that module the problem dissapears as well.

Share this post


Link to post
Share on other sites

In my case I also had the problem that the map was not rendered.

I found out that a javascript (in my case fullcalendar) for initialization was responsible for this behavior. So I decided to put it inline only on that page where I needed it and not in an external javascript file which is included in every page load.

Another point was that if I turn template cache on the map will not be rendered too, so I disable the cache on the template where the map is included.

So if you have problems, please check this 2 points. Maybe this solves your problem.

Share this post


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 BitPoet
      MediaLibrary
      Update: MediaLibrary can now be found in the official module list.
      Out of necessity, I've started to implement a simple media library module.
      The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree.
      The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality.
      I've put the code onto github. This module is compatible with ProcessWire 3.
      Steps to usage:
      Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look.
      Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple.
      There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section).

      Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library.

      Edit 01.05.2016:
      Version 0.0.8:
      - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker).
      - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries.
      - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries.
      Edit 10.10.2018:
      Version 0.1.3:
      - Dropped compatibility for ProcessWire legacy versions by adding namespaces
      - Allow deletion of libraries from the Media overview admin page
      - Added an option to hide media libraries from the page tree (optionally also for superusers)
    • By Robin S
      This module corrects a few things that I find awkward about the "Add New Template" workflow in the PW admin. I opened a wishlist topic a while back because it would good to resolve some of these things in the core, but this module is a stopgap for now.
      Originally I was going to share these as a few standalone hooks, but decided to bundle them together in a configurable module instead.
      Add Template Enhancements
      A module for ProcessWire CMS/CMF. Adds some efficiency enhancements when adding or cloning templates via admin.

      Features
      Derive label from name when new template added: if you like to give each of your templates a label then this feature can save some time. The label can be added automatically when templates are added in admin, in admin/API, or not at all. There are options for underscore/hyphen replacement and capitalisation of the label. Edit template after add: when adding only a single template, the template is automatically opened for editing after it is added. Copy field contexts when cloning: this copies the field contexts (a.k.a. overrides such as column width, label and description) from the source template to the new template when using the "Duplicate/clone this template?" feature on the Advanced tab. Copy field contexts when duplicating fields: this copies the field contexts if you select the "Duplicate fields used by another template" option when adding a new template. Usage
      Install the Add Template Enhancements module.
      Configure the module settings according to what suits you.
       
      https://github.com/Toutouwai/AddTemplateEnhancements
      https://modules.processwire.com/modules/add-template-enhancements/
    • By Mike Rockett
      As I mentioned in this issue, I've create a new textformatter for ParsedownExtraPlugin, which adds some oomph to your markdown.
      Repo: Parsedown Extra Plugin
      Unlike the built-in textformatter for Parsedown and Parsedown Extra, this should be used when you want to use Extra with additional configuration/customisation.
      Some examples:
      ### Test {.heading} - A [external link](https://google.com/){.google} with `google` as a class that opens in a new tab if the config property is set. - [Another link](/page){target=_blank} that opens in a new tab even though it isn't external. ```html .html <p>Test</p> ``` There's some config options available to you, such as setting attributes on all/external images and links, setting table and table-cell alignment classes, adjusting footnote classes and IDs, adding <code> attributes to their parent <pre> elements, and changing the <code> class if your syntax highlighter does not use language-*.
      I was thinking about adding the ability to make links open in a new tab by appending a plus to the link syntax, but only external links should be opening in a new tab anyway. Further, this would add extra, unnecessary processing time.
      Please let me know if you bump into any problems. ☺️
    • By Mike Rockett
      TextformatterTypographer (0.4.0 Beta)
      A ProcessWire wrapper for the awesome PHP Typography class, originally authored by KINGdesk LLC and enhanced by Peter Putzer in wp-Typography. Like Smartypants, it supercharges text fields with enhanced typography and typesetting, such as smart quotations, hyphenation in 59 languages, ellipses, copyright-, trade-, and service-marks, math symbols, and more.
      Learn more on my blog
      It's based on the PHP-Typography library found over at wp-Typography, which is more frequently updated and feature rich that its original by KINGdesk LLC.
      The module itself is fully configurable. I haven't done extensive testing, but there is nothing complex about this, and so I only envisage a typographical bug here and there, if any.
      Please do test it out and let me know what you think.
      Also note that I have indicated support for PW 2.8, but I haven't tested there as yet. This was built on PW 3.0.42/62.
    • By Mike Rockett
      Jumplinks for ProcessWire
      Release: 1.5.50
      Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa.
      The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them.
      Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation.
      Under Development: 2.0, to be powered by FastRoute
      As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run.
      View on GitLab
      Download via the Modules Directory
      Read the docs
      Features
      The most prominent features include:
      Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy:
      Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Feedback & Feature Requests
      I’d love to know what you think of this module. Please provide some feedback on the module as a whole, or even regarding smaller things that make it whole. Also, please feel free to submit feature requests and their use-cases.
      Note: Features requested so far have been added to the to-do list, and will be added to 2.0, and not the current dev/master branches.
      Open Source

      Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.
      Enjoy!