This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Stolen code, thanks Soma ! | |
public function init() { | |
$this->addHookAfter("ProcessPageView::pageNotFound", $this, "hook404Page"); | |
} | |
public function hook404Page($event){ | |
header("HTTP/1.1 404 Page Not Found"); | |
$page = wire("pages")->get("/404/"); // get your 404 page | |
$this->wire('page', $page); | |
$event->return = $page->render(); // render and return that page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config->form = array( | |
// Name of the formbuilder form | |
'formName' => $form_name, | |
// Redirect to here after successful submit. | |
'successUrl' => $success_url, | |
// Global error message after faulty submit. | |
'errorMessage' => $error_message, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* JSON response with a “standardized” structure | |
* | |
* @author ©2015 Martijn Geerts | |
* | |
* --------------------------------------------------------------------------------------- | |
* | |
* 4 types: success, redirect, fail, error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Groups & Products references guard. | |
* | |
* Bidirectional save & remove of products & groups | |
* | |
* templates: | |
* - 'group', pagefield: page_products | |
* - 'product', pagefield: page_groups |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Switch ProcessWire templates directory on $_SERVER['HTTP_HOST']. Type the | |
* Hostname as key and the name of the new templates folder as value. | |
* | |
*/ | |
$config->templates = array( | |
'mobile.domain.dev' => 'templates-mobile', // domain => templates folder name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Build a CSS fractural grid. | |
* | |
* @var (int) $columns, Amount of columns, 10 columns means 10 columns of 10% width | |
* @var (string) $prefix, Classname prefix | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This module is build by Adrian, tnx Adrian. | |
* | |
* | |
* Module to hide pages that are not editable by the logged in user. | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2010 by Ryan Cramer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wire()->addHookAfter('InputfieldForm::processInput', function($event) { | |
$form = $event->object; | |
if($form->name != 'your-form-name') return; | |
$email = $form->getChildByName('email'); | |
if($email) foreach($f->getErrors(true) as $error) { // true clears existing errors | |
if($error == 'Missing required value') { | |
$f->error('Please enter a valid email address'); // replace error message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ProcessWire Emailaddress mailto link | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2010 by Ryan Cramer | |
* Licensed under GNU/GPL v2, see LICENSE.TXT | |
* | |
* http://www.processwire.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ProcessWire files in folder Fieldtype | |
* | |
* ©2013 Martijn Geerts | |
* | |
* ProcessWire 2.x | |
* Copyright (C) 2010 by Ryan Cramer | |
* Licensed under GNU/GPL v2, see LICENSE.TXT |