This file contains 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 (2.5) InputfieldFile front-end upload form example | |
* Various workarounds to get it working with Errors for WireUpload | |
* and removing files upload after error | |
*/ | |
$sent = false; | |
$upload_path = $config->uploadTmpDir; |
This file contains 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 | |
$mypage = $pages->get("/about/"); | |
if($input->post->submit){ | |
$n = 1; | |
$title = "element_title_$n"; | |
$url = "external_url_$n"; | |
$mypage->setOutputFormatting(false); |
This file contains 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 | |
/** | |
* Example form using PW API | |
* | |
* A workaround to get fields display in a table | |
* Those fields are marked with a property added to the fields $field->tablerow | |
* | |
* Approach is to grab those fields after form is put together and maybe processed, | |
* loop each row and render out the fields along with possible errors and add it to a string variable $table | |
* while we remove the field from the form at the same time. |
This file contains 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 | |
/** | |
* include paginator class from ProcessWire core, $config->paths->Modulename can | |
* be used to get the path of any module in PW. | |
*/ | |
require_once($config->paths->MarkupPagerNav . "PagerNav.php"); | |
/** |
This file contains 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 | |
// in form-builder.inc | |
$forms->addHookBefore('FormBuilderProcessor::render', null, 'hookRenderForm'); | |
function hookRenderForm(HookEvent $event) { | |
$processor = $event->object; | |
$form = $processor->getInputfieldsForm(); | |
$form->attr('novalidate', '1'); | |
} |
This file contains 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 | |
/** | |
* Example use: | |
* | |
* $helper = $modules->get("RandomImages"); | |
* $image = $helper->getRandomImages(1,"images"); | |
* echo "<img src='{$image->size(150,0)->url}'>"; | |
*/ | |
This file contains 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 | |
class ImageCreateThumbs extends WireData implements Module { | |
public static function getModuleInfo() { | |
return array( | |
'title' => 'ImageCreateThumbs', | |
'version' => 100, | |
'summary' => '', |