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 Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By horst
      Croppable Image 3
      for PW 3.0.20+
      Module Version 1.1.16
      Sponsored by http://dreikon.de/, many thanks Timo & Niko!
      You can get it in the modules directory!
      Please refer to the readme on github for instructions.
       
      -------------------------------------------------------------------------
       
      Updating from prior versions:
       
      Updating from Croppable Image 3 with versions prior to 1.1.7, please do this as a one time step:
      In the PW Admin, go to side -> modules -> new, use "install via ClassName" and use CroppableImage3 for the Module Class Name. This will update your existing CroppableImage3 module sub directory, even if it is called a new install. After that, the module will be recogniced by the PW updater module, what makes it a lot easier on further updates.
      -------------------------------------------------------------------------
       
      For updating from the legacy Thumbnail / CropImage to CroppableImage3 read on here.
       
      -------------------------------------------------------------------------
       
    • By MoritzLost
      UPDATE: I have published a stable version of this module!
      Discussion thread:
      Github: https://github.com/MoritzLost/TextformatterPageTitleLinks
      ---
      Hello there,
      I'm working on a tiny textformatter module that searches the text for titles of other pages on your site and creates hyperlinks to them. I'm not sure if something like this exists already, but I haven't found anything in the module directory, so I wrote my own solution 🙂
      It's not properly tested yet and is still missing some functionality I would like to implement, so at the moment it should be considered in BETA. Features include limiting the pages that will get searched by template, and adding a custom CSS class to the generated hyperlinks. As I'm writing this I noticed that it will probably include unpublished and hidden pages at the moment, so yeah ... it's still in development alright 😅
      You can download the module from Github:
      https://github.com/MoritzLost/TextformatterPageTitleLinks
      There's some more information in the readme as well.
      Anyway, let me know what you think! I'm happy about any feedback, possible improvements or ideas on how to improve the module. Cheers.
    • By blad
      Hi guys!
      I just uploaded a module to explore files based on elFinder. By default it will show the "Files" folder.
      Screenshots:

      Video:
       
      To do:
       More options To fix:
       The function of rotating or scaling an image fails  Image editors V 1.01 (view issue)
      Fixed the bug working with the Multi-Language support ( translation of folders ). Fixed the name of elfinder.en  Github:
      https://github.com/LuisSantiago/ProcessElFinder/
      I hope you like it.
    • By BitPoet
      I'm really in love with FormBuilder, but the one thing missing to match all my end users' expectations were repeatable field groups. Think repeaters, in ProcessWire terms. Our primary application of PW is our corporate intranet, so "lines" of fields are quite common in the forms I build. We have all kinds of request forms where the information for a varying number of colleagues needs to be entered (from meal order to flight booking request) and where it is simply impractical to send a form for each, and I don't want to clutter my forms with multiple instances of fields that may only get used ten percent of the time.
      That's why I started to build FormBuilderMultiplier (link to GitHub).
      What it does:
      Adds an option to make a regular Fieldgroup repeatable Lets you limit the number of instances of a Fieldgroup on the form Adds an "Add row" button the form that adds another instance of the Fieldgroup's fields Adds a counter suffix at the end of every affected field's label Stores the entered values just like regular fields Makes the entered values available in preview and email notifications Supports most text based fields, textareas and selects (really, I haven't had enough time to test all the available choices yet) What it doesn't do (yet):
      Support saving to ProcessWire pages (i.e. real Repeaters) I haven't tested all the validation stuff, Date/Time inputs etc. yet, but since I'm utterly swamped with other stuff at work, I didn't want to wait until I have it polished. Any feedback is welcome. There might also be some issues with different output frameworks that I haven't encountered yet. The forms I work with mostly use UIKit.
      Status:
      Still alpha, so test well before using it in the field.
      Known issues:
      When rows are added, the form's iframe needs to be resized, which isn't completely clean yet.
      How it works:
      The Fieldgroup settings are added through regular hooks, as is the logic that adds the necessary field copies for processing the form and displaying previews.
      "Multiplied" field instances are suffixed with _NUM, where NUM is an incremental integer starting from 1. So if you have add two fields named "surname" and "givenname" to a fieldgroup and check the "multiply" checkbox, the form will initially have "surname_1" and "givenname_1" field (I'm still considering changing that to make the risk to shoot oneself into the foot by having a regular "surname_1" field somewhere else in the form less likely).
      When a "row" is added, the first row is cloned through JS and the counter in the fields' IDs, names and "for" attributes as well as the counter in the label are incremented before appending the copies to the Fieldset container in the form.
      To keep backend and frontend in sync, a hidden field named [name of the fieldset]__multiplier_rows is added to the form. Both the backend and the frontend script use this to store and retrieve the number of "rows".
      ToDo:
      Naturally, add the option to store the data in real repeaters when saving to pages. Do a lot of testing (and likely fixing). Make a few things (like the "Add row" button label etc.) configurable in field(set) context. Add a smooth API to retrieve the multiplied values as WireArrays. The mandatory moving screenshot: