Jump to content

Search the Community

Showing results for tags 'Module'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hey there, this is a little helper I'm using on some sites, thougth mabe someone is interested. With this simple module you can easily add pages to a global blacklist and use it for filtering of subsequent selector queries. The idea is the following: Let's assume you have something like a blog. You have a simple list of articles in the main column of the page, showing the newest articles from every category. Also you have a small teaser on the right sidebar, showing the latest articles filed under a special category, like news. Now you possibly don't want that teaser to include articles, which are already in the big list in the main column. PageBlacklist is a small module, helping you to implement blacklisting on for such cases. Assuming the scenario on the top, your code could look something like this: // Retrieve the maincol list and add to blacklist $bigList = $pages->find('template=article, sort=-created'); $pageBlacklist->add($bigList); // Possibly you will output $bigList here // Retrieve the sidecol teaser, excluding blacklisted articles $teaser = $pages->find('template=article, parent=news, sort=-created, ' . $pageBlacklist); // Basically, this will alter the selector to something like: // 'template=article, parent=news, sort=-created, id!=1012,1031,1153' I would love to hear ideas to improve this helpfull little module. You can find PageBlacklist on GitHub: https://github.com/tsdtsdtsd/PageBlacklist
  2. Is there a example / howto write custom fieldtype / inputfield module? Searched the forum and asked google. If there is no howto available someone could suggest an easy module to take a look at the source code.
  3. Hey guys, Rookie with processwire here (especially when it comes to modules). I wan to customize the html output that the comments module generates. At first I attempted to create my own module but then realised I am re-inventing the wheel and there should be an easier way to customise the output. Now my logic thought out that by moving the wire/modules/Fieldtype/FieldtypeComments folder could sit comfortably in site/modules/Fieldtype/FieldtypeComments folder as well. That didn't work either. All I really need to do is to modify the CommentList.php file to output the html I want. I've attempted reading around and looking for answers on the forums but I found some answers relating to customising Modules to be a bit confusing (mainly focussed at creating modules not customising*) and it seems that other people haven't had an issue with this so not finding a lot of questions like mine. Any help would be awesomely appreciated!
  4. DrLunesTypeManager is a Template Helper. DrLunesTypeManager asks you for a typekit ID, Google Fonts Family, CDN, Custom CSS and more, and outputs the code needed to use this fonts in your templates. It also forces some tags to use this fonts and your custom CSS styles to be applied to the page. DrLunesTypeManager in github: https://github.com/biojazzard/DrLunesTypeManager Inspiration Inspired by [Dr. Rober´s](rober@1un.es) needs. ProcessWire is about efficient code, but sometimes humans need helpers. Install Via PW: + Download zip + Use modules administrator in PW to upload it to the server. + Open it and configure it with your settings. Install Via GIT: I´m not a git pro, but it´s nice to have modules as a subtree so it´s not a pain to mantain, and you can easily reuse it in other projects keeping it´s development in github as well. + Fork [DrLunesTypeManager](git@github.com:biojazzard/DrLunesTypeManager.git) + Ad it as a subtree in git with relative path site/modules/ + Edit it as you like. + Install DrLunesTypeManager with modules administrator in PW. + Open it and configure it with your settings. Module [sample] Settings Using DrLunesTypeManager in templates. Last thing is to output code, this can be done in your: $config->appendTemplateFile + DrLunesTypeManager uses jQuery. So output code AFTER **jQuery** is loaded, usually in your ``head``, but preferably before ``body`` tag. <?php // Get Module $typekit = $modules->get('DrLunesTypeManager'); // Render Script & Settings. echo $typekit->render(); // It´s done. ?> html outout MODULE-VALUE-* represents your value settings in Module´s Settings <script> WebFontConfig = { typekit: { id: "MODULE-VALUE-TYPEKIT-ID" }, google: { families: ["MODULE-VALUE-GOOGLE-FONT"] } }; (function() { var wf = document.createElement("script"); wf.src = ("https:" == document.location.protocol ? "https" : "http") + ":MODULE-VALUE-TYPEKIT-CDN"; wf.async = "true"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(wf, s); })(); // TypeKit Classes added to main text tags (function($) { $("p").addClass("MODULE-VALUE-BODY-CLASS") $("ul").addClass("MODULE-VALUE-BODY-CLASS") $("h1, h2, h3").addClass("MODULE-VALUE-H13-CLASS") $("h4, h5, h6").addClass("MODULE-VALUE-H46-CLASS") })(jQuery); </script> If you are using the **Custom CSS** field, you may add ``!important`` in order to get this styles loaded as expected: h1.tk-cubano { letter-spacing: -1px; color: hsla(360, 94%, 32%, 0.76) !important; // FORCE RED text-shadow: 1px 1px 3px hsla(360, 94%, 32%, 0.3); //SHADOW } With love. 1un.es
  5. Is it possible to make a "Add New" Shortcut-Button on a Custom Admin Page e.g in the ProcessDashboard Module instead on the Sitetree Page?
  6. Are there any modules for Comment System and Upvote Downvote System in PW? I would like to implement a comment system in PW. Used WP in the past and it is built in. Are there any modules for that? Also another feature of my website would be upvote downvote system. Where users can vote on a POST and then it will show up on my sidebar let say as POPULAR POSTS or I could just get it via how many views my posts gets Thank you
  7. Hello everbody I want to make a autoload module that checks if the current page template exist, when not it should make a redirect to its parent page. I thought of something like this: public function init() { if(!$this->page->template->filenameExists()) continue; $this->session->redirect($this->page->parent->url); } My Problem is that when i add a Page via Fredi from the Frontend it redirects to a page that doesnt exist in the frontend. This is because I create Classifications Pages that have a template but not a template file because its not necessary in my case. I know, that i could just write in the templates something like this: $session->redirect($page->parent->url); But they are 8 templates that i have to create and write this and in my view that is unnecessary when i could achieve this only via a module. Thank you for your attention - Nukro
  8. Hi I am looking to purchase the form builder as part of our move to Processwire but there is one outstandling item on my research that I need answered. The form builder does 99% of what I need. However, I need to be able to build forms with a custom address lookup component. Is this something we can add as a custom field into the form builder? Thx Z
  9. Anyone made or or would be interested in a instagram module that displays a profiles images? also if you have any pointers that would be helpful. Thanks
  10. Plyr Media Player for ProcessWire ! beta status. This module is "work in progress" v0.2 ! Please be patient as this is my very first public module ^^ This module adds the Plyr HTML5 Media Player (plyr.io) to ProcessWire. Plyr is basically a wrapper for the natural media interface in modern browsers. It adds the ability for easy styling via CSS and a sprite, while being fully responsive. Also Plyr gives you full controll over the player with its great javascript interface. MarkupPlyrMediaPlayer incorporates Plyr for ProcessWire. -> GitHub -> Module directory Current capabilities After installation, you will notice some module configuration options. These are: - Automatic Mode If enabled, this option will automaticaly add all needed resources into your pages output. - Use CDN Use the official Plyr CDN (Content Delivery Network) for resources? The following resource options are only required if you don't wish to use the CDN: - Path to CSS file (Path to your CSS file, required to style the players.) - Path to Plyr library (Path to the Plyr javascript library, required for the functionality.) - Path to SVG sprite (Path to your SVG sprite image file, required to style the players.) Automatic mode If automatic mode is enabled, the module hooks after the page rendering and automatically adds the stylesheet to HTML head. Also adds an AJAX call to fetch the SVG sprite and the Plyr javascript library right before the ending body-tag. Also, while in automatic mode, that extra markup will only be rendered if a template made a render request for a Plyr player. So there will be no unnecessary load on your site. Get module $plyr = $modules->get("MarkupPlyrMediaPlayer"); Add a video player to your template echo $plyr->renderVideoPlayer($poster, $mp4, $webm, $captions); The $captions-Array contains details of the caption tracks: $captions = $caption = array(); $caption['label'] # Something like "English captions" $caption['src'] # http://...movie_captions_en.vtt $caption['srclang'] # en|de|ru|... $caption['default'] # true|false array_push($captions, $caption); Add an audio player to your template echo $plyr->renderAudioPlayer($mp3Path, $oggPath); Add the YouTube-wrapper to your template echo $plyr->renderYoutubePlayer($videoId); Manual mode If automatic mode is disabled, you have to render these parts manualy in your page template. Important: This method will not check if a player was requested. In the HTML head: <html> <head> ... <?php echo $plyr->renderHeadLink(); // Basicly just a <link rel="stylesheet" href="..."> ?> </head> ... And in the footer somewhere before the closing body-tag: ... echo $plyr->renderScripts; // AJAX call for SVG and JS library inclusion </body> </html> Where is this going? Before getting a v1.0.0 stable release, this module should be capable of following features: - [done] Load resources from CDN or local files - Reliable automatic mode with fallback to local - Brings specific Inputfields for video, audio and youtube for the backend and frontend markup rendering - Every Plyr javascript setting can be handled via module configuration
  11. Hi, I'm not sure if this can be useful or not. Check by your self. I have created a little module around a set of 42 svg icons. (nearly a copy from Windows 10 iconset). It is very rudimentary at the moment. One can define settings for colors and size of the svg variations. Variations will be created on demand in a central directory (assets/svgicons/) and cached for later usage. The settings can be passed as selectorstrings. You can use a template variable $icon. To output markup for a plain svg icon in an image tag, you need to call the name: echo $icon->img("name=lock"); echo $icon->img("name=unlock"); If you want use it as a rollover with hover state, you need to call the function markup: echo $icon->markup("name=attention"); This gives you markup with default settings. If you need a clickable link, just define it in the selector string: echo $icon->markup("name=attention, link=/about/"); You can set / change the default values from template like: $icon->setColors(array(0, 111, 187, 0.2), array(219, 17, 116, 1.0)); $icon->setSize(180); and / or you can use individual settings for each icon: echo $icon->markup("name=document, size=32, color1=#775599, color2=blue, link=/about/"); // HEX colors or named colors echo $icon->markup("name=idea, size=120, color1=255-255-0-0.3, color2=255-255-0-1, link=/about/"); // RGBA colors echo $icon->markup("name=home, size=20, color1=230-0-0, color2=230-0-0, link=/about/"); // RGB colors . For the rollover / hover markup there is a piece of css needed what can be outputted (only once). It can be fetched with or without the style-tags: echo $icon->css(); // with style tags echo $icon->css(true); // suppress the style tags . The functions that does not output markup return the module itself (the $icon object). So you can use them chained: // all functions that can be chained: $icon->emptyCache()->setSize(100)->setColors(array(0, 111, 187, 0.25), array(243, 79, 159)); // after such a (re)set call, you only need to pass a name to each icon call to get consistent results: echo $icon->markup("name=lock, link=/logout/"); echo $icon->markup("name=unlock, link=/login/"); // you can override single settings, ->mu() is a shortcut for ->markup() echo $icon->mu("name=trash, size=200"); echo $icon->mu("name=key, color2=red"); // ->presentation() print the whole collection with optionally individually specified size and colors: echo $icon->presentation(100, array(0, 111, 187, 0.25), array(243, 79, 159)); . . . The code is here in a gist: https://gist.github.com/horst-n/f6922f6fa228991fd686 . Download it as ZIP! . . A live demo is here: http://images.pw.nogajski.de/svg-icons/ . .
  12. My wife kindly asked why it isn't possible to type tabulators in an inputfield. Here is the answer: Inputfield which allows using the tab key to write tabulators in an Inputfield. Disables switching field focus functionality of the tab key. Use the mouse to get to the next input. Against some principals module doesn't respect minimum accessibility guidelines. Download from github https://github.com/kixe/InputfieldTextareaTabKey Tested in Firefox and Safari on Mac.
  13. I have a PW site which is integrated with Snipcart and now the owners want to add stock management. Because each item comes in different sizes and colours, I'm using a repeater field with each row containing a size column. The guys at Snipcart have written a blog post on how to achieve basically what I need in a plugin for Craft CMS. I need that converted into a module for PW and instead of updating an individual field, it's updating a column in a repeater field. Anyone able to help me out with that?
  14. Some time ago there was a question if it's possible to change the "name" field on the users to "Username". Here's how I answered with a module example. May it be helpful to someone. <?php class UserNameLabel extends WireData implements Module{ public static function getModuleInfo() { return array( 'title' => __('UserNameLabel', __FILE__), // Module Title 'version' => 100, 'summary' => __('Overwrite User Name Label', __FILE__), // Module Summary 'autoload' => true ); } public function init() { // only add hook if on user pages if(strpos($_SERVER['REQUEST_URI'],'/users/') !== FALSE ) $this->addHookAfter("Inputfield::render", $this, "changeLabel"); } public function changeLabel($event){ $inputfield = $event->object; // only if the right inputfield if(!$inputfield instanceof InputfieldName ) return; // overwrite the label return $event->object = $inputfield->label = __("Username"); } } UserNameLabel.module.zip
  15. New Module which adds 1 more, but very tiny green buttons to the page list. It saves minimum 3 klicks to change page status from hidden to visible. Edit: update 11.12.14 Module provides up to 3 (more) buttons in page list to toggle status (hidden/visible, published/unpublished and locked/unlocked). Enable/Disable the buttons in the settings (screenshot) ProcessPageStatusToggler.module
  16. Zero setup page rendering with caching, with simple replacements. Useful if you have complicated templates (or a large number of less complicated ones), where you often need to do a small number of adjustments. In this case, caching on the template level doesn't completely make sense — because it either uses cache, or doesn't. This module solves this problem by using markup cache all the time, but allowing us to modify the output by replacement of simple strings. - On GitHub - On modules.processwire.com Edit: Also, small thanks to Tom Reno for testing what single language install return for $user->language
  17. hello world sometimes it would very helpful if there would be a «cross asset selector». my idea is to upload the images/pdfs etc. just once in a manager (similar to soma's images manager) and then to be able to select the assets via regular image field (or a new one). clients wouldn't have to upload the images more than once (and crop, resize etc.) and it would save a lot of disk space. any feedback about the idea? thanks
  18. Just thought I'd share this module which I modified from the PageEditPerUser module by Ryan Cramer. I needed page-specific edit access by roles, not by user. So... Overview Assign edit access to roles on a per-page basis. Description The user must already have page-edit permission on one of their roles in order to get edit access to assigned pages. Otherwise, they will only gain view access. This module is fully functional as-is, but intended as a proof-of-concept for those wanting to go further with adding custom edit and/or view access. How to install 1. Copy the PageEditPerRole.module file to /site/modules/ 2. Go to Modules in the ProcessWire admin and click "Check for new modules" 3. Click "install" for "Page Edit Per Role" How to use 1. Create a new role called "editor" (or whatever you want to call it) and give the role "page-edit" permission. If you already have a role in place that you want to use, that is fine too. 2. Under "Access > Roles" locate the role you want to assign edit access to. Edit this role. 3. For this roles's "Editable Pages" field: select one or more pages you want users with this role to be able to edit. 4. Save the role. 5. Under "Access > Users" locate the user you want to apply the role to. Edit this user. 6. For this user's "Roles" field, select the new role you added - "editor". 7. Save the user and your are done. 8. To test, login as the user you edited to confirm it works how you expect. Download http://modules.processwire.com/modules/page-edit-per-role/
  19. TextformatterImageInterceptor ( Textformatter module ) Let editors use WYSIWYG images, but let you control the image size, aspect ratio & behaviour. How to install Copy the TextformatterImageInterceptor.module file to your /site/modules/ directory (or place it in /site/modules/TextformatterImageInterceptor/). Click check for new modules in ProcessWire Admin Modules screen. Click install for the module labeled: "Image Interceptor". Go to the module config screen and set the settings you wish. How to use Edit your body field in Setup > Fields (or whatever field(s) you will be placing controlled images in). On the details tab, find the Text Formatters field and select "Image Interceptor". Save.About the settings Render Inline styles If checked, some inline styles are added to the image.High Density Double the pixel width of an image if the percentage is not set. (fixed image size)Default there are settings for landscape & portrait images. Squared images will inherit all settings belonging to portrait settings and there's a way to escape the default settings. But before we dive deeper in tagged sets I want to spread some light on the landscape/portrait settings. All images portrait/landscape wil get the class name .default. ps, All images including tagged set images get the image orientation as class (.landscape / .portrtait) Percentage The width of the image in percentage. This setting makes the image responsive or if left blank the image wil be fixed size. Images receive a .responsive and a .p-50 class (where 50 is the width in percentage) Width The width of the image in pixels. So the width of the image in percentage and the pixel width combined wil be the key to pixel desity. Alignment There are 5 different ways to align an image. left, center, right, inherit (inherits from the WYSIWYG editor) and not aligned. If render inline styles is checked the aligment wil be set directly in the inline style of the image. Alignment classes wil be added to the image. Aspect Ratio (cropping) if an aspect ratio is given, the image will be cropped to the given ratio. If you type 2:1 in the landscape settings. Images 800 pixels wide, will be croped to a 800x400 image. The image gets the following classes: .cropped and .crop-2x1 Image Captions Type here your class name(s) for the caption. When a class name is provided and an image has a description, the image is wrapped (if not already) and *has-* is set in front of the class name(s). For the caption a div is created with the class name(s) and the image description as text. Next to these settings. You can give custom classes to images. This way you can give it framework specific classes for example. And you're allowed to wrap the images with custom HTML. (Some frameworks needs additional HTML to make images more fancy) Then additional styles could be added to images if render inline styles is checked. Tagged sets Tagged sets are an image tag followed by settings specific for images with that tag. To enable tagged sets, the image field need "Use Tags?" to be checked. Go to setup, then fields go to your image field and under the details tab check "Use Tags?". Taged sets are a good way to escape the default image behaviour. Say you have a bunch of nicely ordered images on the page, but you want to show a company logo on 150px floated left. With tagged sets it's no problem. type: (logo 150px left) on one line and you've created your first tagged set. (don't forget to tag the image to) If you want captions for a tagged set, keep in mind that captions need at least 1 class. The format to enter: caption.class-name. For an image wrapper we use the same rules. The only difference is we start typing wrapper followed by class names starting with a dot. example: wrapper.logo.stand-out. You can have a multitude of sets, every set on it's own line. Every set needs at least a tag-name and a pixel width. Note: If you use a wrapper or captions (wrapper will be created if none is set), the inline styles and specific width & alignment classes will be set to the wrapper and removed from the image. This way no duplication of styles wil take place. github modules directory
  20. I'm trying to modify the property 'path' for a specific Page (User, actually) using the following code: $this->addHookAfter("Page::path",$this,"modifyUserPagePath"); AND public function modifyUserPagePath(HookEvent $event){ $p = $event->object; if($p->template == "user" && $p->hasRole("ambassador")){ die("MODIFY THE PATH HERE WITH PREFIX FOR THE CURRENT VIEWING PAGE"); } } But i'm not able to retrieve the page that is currently running (as in, the page in the browser url). Please note I'm also using the render() method to render subpages content. I don't need the subpages url but only the original $page requested. Is there a pretty way to do this (besides looking it up via $_SERVER['REQUEST_URI'] )?
  21. jQuery DataTables 1.9.4 This module adds the great jQuery DataTables plugin for use in ProcessWire. You can load the module in the admin from any of your module using: $this->modules->JqueryDataTables; This will load the module and add CSS and Javascript from DataTables. This mostly would be used by a custom admin Process module. Note: Loading this module will just attach the necessary files to the admin. To use it you would need to add your own jQuery scripts and init the DataTables with something like. $("#mytable").dataTable(settings); For more informations on the DataTables options and API refer to http://datatables.net/ Download: http://modules.processwire.com/modules/jquery-data-tables/ https://github.com/somatonic/JqueryDataTables I included only the necessary files, and removed examples and docs from the package. NOTE: To avoid confusion, THIS module has nothing to do with my ProcessDataTable module for ProcessWire! ProcessDataTable was a proof of concept integrating it in a admin page. It included the jQuery DataTables plugin, but unfortunately it may wasn't a good way to. JqueryDataTables is a special js module like Fancybox. It is a "integration" of the jquery plugin for developers to use datatables in their modules. It won't be loaded unless you do so. An example would be the ModulesManager. They can coexist if you will.
  22. Hey, so after having used the Fieldtype Select for a few project I had some customers that wanted a radio version of this so I decided to modify it (not heavily) and make it work with radio buttons instead. I have it hosted up on github here so check it out and let me know if you have question or comments.
  23. Hey PW, I am only a starting developer and I am still in school and my experience with processwire is quite small but recently I've created my own module for Processwire and I kind of had to ask and copy a lot from other sources, now I want to create a small walk through tutorial for people with the same lack of knowledge as me And as a guide for myselfs in the future 1) Setting up the file. Okay, so we start of by making a new document in the Module root folder and call it Harmster.module for this example, we dont need to add the .php extension. Now every module in Processwire needs to extends the classes and methods from Processwire itselfs so we start off by typing class Harmster extends Process{ } You can also extend WireData, I don't really understand the difference but both work for me A module contains 2 standart classes, init() and getModuleInfo() init() This is kind of, or the same as a __construct() method, this always executes and is executed almost at creation. getModuleInfo() This is a method that is used to show the information in the Processwire CMS. We both need to add these to our fresh class like following: class Harmster extends WireData { public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 100, 'summary' => 'Harmster module' 'singular' => true, ); } public function init() { $this->setFuel("harmster", $this); } This is where I, as a starting developer, get really excited about this little code in the init() method $this->setFuel("harmster", $this); Basically creates your class in every template you are going to use and it is callable by $harmster Woah! awesome right! Now this is where I got stuck on, I the user to configure some options in the module :\ hmm... Well I just went asking on the forums and the super nice community of PW came to help me, Wanze in this case (no emoticon because its not allowed) (Check it for yourselfs, http://processwire.c...lds-for-module/) And basically you need to implement some methods from an another object, you should replace this, class Harmster extends WireData implements Module with class Harmster extends Process implements Module, ConfigurableModule But when you add that and try to use your module you'll see you get an error, we need to add one more method to the class called getModuleConfigInputfields add static public function getModuleConfigInputfields(array $data) { } 2) Adding a configurable and usable textbox But now you want to add some input fields, now this is pretty hmm complicated For a simple textbox you put this inside the method you just made: $modules = Wire::getFuel('modules'); $fields = new InputfieldWrapper(); $field = $modules->get("InputfieldText"); $field->attr('name+id', ''some_text_field_saved_name''); $field->attr('value', $data['some_text_field_saved_name']); $field->label = "Hamsters rule!"; $field->description = 'Enter a nice sentance here if you like hamsters'; $fields->append($field); Now you've created a input field and you can use it with $this->get(''some_text_field_saved_name''); in all your methods in this class (no emoticon because its not allowed) If you're lazy Now what you've created is a configurable module, heres a I am lazy and i want to pastey (no emoticon because its not allowed) class Harmster extends Process implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 001, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->fuel->set("harmster", $this); } static public function getModuleConfigInputfields(array $data) { } } Now if you want to add a overview page, much like the setup, pages, acces and module tab in Processwire CMS default you can easily do this by adding 2 new methods in your class, install and uninstall 3) Creating your install and uninstall So you want to get a nice overview for your module now eh? Well we can do that because Processwire is awesome like that I did this for my module Now, we need to add 2 methods to our class, ___install and ___uninstall (yes, 3 underscores) So add this to your class: public function ___install() { } public function ___uninstall() { } I think that these are kind of self explaing, the one method gets executed when the user installs the module and the other one gets executed when the user deinstalls the module. Now we want to add a page to PW CMS, but how (no emoticon because its not allowed) Thats actually really easy, $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'MailChimp'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } This is how you install a page, notice that we name the page to self::PAGE_NAME therefor you want to add const PAGE_NAME = 'harmster-module'; with the name of your module BUT BUT now everyone can look in to this module D:< i dont want that! Ofcourse you dont want that. Clients are famous for breaking everything where they put their hands on, so we need to create permissions! Now the way you make permissions is just genius and so easy, you just add this to your ___install method, $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } And you create a permission constant just like PAGE_NAME like this const PERMISSION_NAME = 'hr-view'; And of course you can create more permissions, just genius! Now what our install method should look like is this: public function ___install() { $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Harmster'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } } This will set a module page up for you And we create an uninstall method, this basicly reverts your installed permissions and pages. public function ___uninstall() { $permission = $this->permissions->get(self::PERMISSION_NAME); if ($permission->id) { $permission->delete(); } $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if ($page->id) { $page->delete(); } } Now you are might be wondering, how do i get to display content in my page :S Well, I kinda stole this from other modules and it does work, but I am open for suggestions. the method ___execute gets executed when you click on your page in the PWCMS. What i wrote in there is public function ___execute() { return $this->_renderInterface(); } and in renderInterface() i put the next code: private function _renderInterface() { $this->setFuel('processHeadline', 'MailChimp synchronize tool'); $form = $this->modules->get('InputfieldForm'); $form->attr('id','ga_form'); $wrapper_audience = new InputfieldWrapper(); $field = $this->modules->get("InputfieldMarkup"); $field->label = $this->_("Gebruikers"); $field->columnWidth = 100; $members = $this->list_members($this->get_apikey()); $html = "<table class='AdminDataTable AdminDataList AdminDataTableSortable'>"; foreach($members['data'] as $member) { $html .= "<tr><td>" . $member['email'] . "</td><td>" . $member['timestamp'] . "</td></tr>"; } $html .= "</table>"; $field->attr('value',$html); $wrapper_audience->append($field); $form->append($wrapper_audience); return $form->render(); } Bascily you create a form and you render the form and that displays it for you, just play around with it for a bit and you'll get into it, as i am still getting into it. I am lazy, here a copy, pastey (no emoticon because its not allowed) <?php class Harmster extends Process implements Module, ConfigurableModule { const PAGE_NAME = 'harmster-module'; const PERMISSION_NAME = 'hr-view'; public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 001, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->fuel->set("harmster", $this); } static public function getModuleConfigInputfields(array $data) { } public function ___install() { $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Harmster'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } } public function ___uninstall() { $permission = $this->permissions->get(self::PERMISSION_NAME); if ($permission->id) { $permission->delete(); } $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if ($page->id) { $page->delete(); } } public function ___execute() { return $this->_renderInterface(); } private function _renderInterface() { $this->setFuel('processHeadline', 'MailChimp synchronize tool'); $form = $this->modules->get('InputfieldForm'); $form->attr('id','ga_form'); $wrapper_audience = new InputfieldWrapper(); $field = $this->modules->get("InputfieldMarkup"); $field->label = $this->_("Gebruikers"); $field->columnWidth = 100; $members = $this->list_members($this->get_apikey()); $html = "<table class='AdminDataTable AdminDataList AdminDataTableSortable'>"; foreach($members['data'] as $member) { $html .= "<tr><td>" . $member['email'] . "</td><td>" . $member['timestamp'] . "</td></tr>"; } $html .= "</table>"; $field->attr('value',$html); $wrapper_audience->append($field); $form->append($wrapper_audience); return $form->render(); } } I'll update this tutorial in the near future as i am still working my way up (no emoticon because its not allowed) Aww, i get an error when i save it, thats not nice. Thanks for reading (no emoticon because its not allowed)EDIT Updating this tutorial very soon, its horrible and incorrect
  24. Quickly toggle your checkboxes with extra action buttons via AJAX. The module adds functionality to InputfieldCheckbox so you can toggle the checkbox fields in the extra action buttons intruduced in ProcessWire 2.6.5 via AJAX. Github Page Download Link Requirements This module works only for ProcessWire versions later than 2.6.5. How to Install 1. Copy the files to /site/modules/ProcessQuickToggle/ 2. In your admin, go to Modules > Refresh for new modules. 3. Click the "Install" button next to "Process Quick Toggle". Usage Go to any checkbox field you want to enable quick toggle feature for. Setup > Fields > my_checkbox_field. There in the Input tab you should see an Enable Quick Toggle field. After you check it you will see some fields that you can fill based on your needs. Then save the field. Now there should be an extra button for every page that has this field in the Pages tree. Features Supports template contexts. Supports core FontAwesome icons. Any kind of feedback is appreciated.
  25. Is it possible to keep the modal open after saving? I regularly edit/test/change some content and it is kind of annoying to reopen the modal when i'm right into editing and just want to see, how it looks in the frontend. thanks!
×
×
  • Create New...