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 Lex Sanchez
      Video or Social Post Embed
      Based on the TextformatterVideoEmbed module developed by Ryan Cramer, we have added the possibility to embed publications of the main social networks Facebook, Twitter and Instagram.
      ProcessWire Textformatter module that enables translation of YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu URLs to full embed codes, resulting in a viewable video or social post in textarea fields you apply it to.
      How to install
      Download or Clone from Github: https://github.com/lexsanchez/VideoOrSocialPostEmbed
      Copy the VideoOrSocialPostEmbed.module file to your /site/modules/ directory (or place it in /site/modules/VideoOrSocialPostEmbed/).
      Click check for new modules in ProcessWire Admin Modules screen. Click install for the module labeled: "Video or Social Post Embed".
      Now you will be on the module config screen. Please make note of the config options and set as you see fit.
      How to use
      Edit your body field in Setup > Fields (or whatever field(s) you will be placing videos in). On the details tab, find the Text Formatters field and select "Video or Social Post Embed". Save.
      Edit a page using the field you edited and paste in YouTube, Vimeo, Facebook, Twitter, Instagram and/or Issuu URLs each on their own paragraph.
      Example
      How it might look in your editor (like TinyMCE):
      How it works
      This module uses YouTube, Vimeo, Instagram, Facebook, Twitter and Issuu oEmbed services to generate the embed codes populated in your content. After these services are queried the first time, the embed code is cached so that it doesn't need to be pulled again.
      Configuration
      You may want to update the max width and max height settings on the module's configuration screen. You should make these consistent with what is supported by your site design.
      If you change these max width / max height settings you may also want to check the box to clear cache, so that YouTube/Vimeo/Facebook/Twitter/Instagram/Issuu oembed services will generate new embed codes for you.
      Using with Markdown, Textile or other LML
      This text formatter is looking for a YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu video URL surrounded by paragraph tags. As a result, if you are using Markdown or Textile (or something else like it) you want that text formatter to run before this one. That ensures that the expected paragraph tags will be present when VideoOrSocialPostEmbed runs. You can control the order that text formatters are run in by drag/drop sorting in the field editor.
      Copyright 2018 by Ryan Cramer / Updated by Lex Sanchez
    • By kixe
      Email Verification
      This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.
      Download
      https://modules.processwire.com/modules/email-verification/
      API
      // get module $mailcheck = $modules->get('EmailVerification'); // return bool/ string - automatted update of blacklist file $mailcheck->blacklisted(email|domain) // return bool - validate a top level domain, checks against IANA list $mailcheck->validTLD(tld) // return array of punycoded TLDs - cyclic updated, data pulled from IANA $mailcheck->getTLDs(cycle=2592000) // return bool - checks syntax converts to punycode $mailcheck->validDomainName(domain); // return bool - checks punycode encoded syntax $mailcheck->validHostName(host); // return bool - checks syntax and accessibility $mailcheck->validHost(email|domain) // add a single value to blacklist $mailcheck->addToBlacklist(email|domain) USAGE
      $mailcheck = $modules->get('EmailCheck'); $email = 'susi@trashmail.com'; if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed'; if(!$mailcheck->validHost($email)) echo 'Mailhost not available'; Example blacklist file:  blacklist.txt
       
    • By teppo
      Code Blocks Textformatter is a tiny Textformatter module I cooked up to add support for code blocks to text/textarea/RTE fields on some of the sites I work with. Unlike a full-blown Markdown Textformatter – which is something that we already have in the core – this module simply adds support for fenced and inline code blocks.
      The syntax is based on the GitHub code block documentation, so please refer to that for additional instructions. The README at GitHub also includes some basic examples. As with any Textformatter, in order to enable this one, install it and enable it via field settings. Note that there's no syntax highlighting built in (at least for the time being), so use a tool of your choice for that – personally I prefer Prism.js.
      Since this module doesn't use a Markdown tool behind the scenes, but rather some home baked regular expressions, there's always the possibility that I've missed something – but please let me know if you use this module and run into any issues. On the other hand this module should be relatively fast and unobtrusive, as there are no unnecessary bits of code to run 
      GitHub repository: https://github.com/teppokoivula/TextformatterCodeBlocks Modules directory: http://modules.processwire.com/modules/textformatter-code-blocks/
    • By theo
      Here is my first processwire module (beta).
      https://github.com/theo222/ImagePickerField
      A lot of "first times". First time Github, Markdown and of course PW Modules.
      So be gentle please.
      I hope it works.