Skip to content

Instantly share code, notes, and snippets.

Avatar

Teppo Koivula teppokoivula

View GitHub Profile
View ImageSizerEngineGDAlt.module.php
<?php namespace ProcessWire;
class ImageSizerEngineGDAlt extends ImageSizerEngineGD {
public static function getModuleInfo() {
return [
'title' => 'GD Image Sizer (alternative version)',
'version' => 1,
'summary' => "Uses PHP’s built-in GD library to resize images (alternative version, see https://github.com/processwire/processwire-issues/issues/1154).",
];
@teppokoivula
teppokoivula / init.php
Created Apr 13, 2019
Generate search index for saved pages in ProcessWire
View init.php
<?php
/**
* Generate search index for saved pages
*
*/
$this->addHook('Pages::saveReady', function(HookEvent $event) {
$page = $event->arguments[0];
if ($page->id && $page->hasField('search_index')) {
$page->search_index = indexPage($page, array(
@teppokoivula
teppokoivula / out.json
Created Mar 15, 2014
Another Page Tree Migrator test
View out.json
{
"pages": [{
"name": "test-page",
"parent_name": "",
"page_template": "basic-page",
"status": 1,
"sort": 7,
"sortfield": "sort",
"data": {
"title": "Test page",
@teppokoivula
teppokoivula / out.json
Created Mar 15, 2014
Page Tree Migrator sample output
View out.json
{
"pages":[
{
"name":"test-page",
"parent_name":"",
"page_template":"basic-page",
"status":1,
"sort":7,
"sortfield":"sort",
"data":{
View lv_ct_test.php
<?php
// Bootstrap ProcessWire
require "index.php";
// Install LanguageSupportFields (unless already installed)
if (!wire('modules')->isInstalled('LanguageSupportFields')) {
wire('modules')->install('LanguageSupportFields');
}
@teppokoivula
teppokoivula / repeater-test.php
Last active Jan 28, 2017
Testing ProcessWire repeater behaviour in API use
View repeater-test.php
<?php
// Bootstrap ProcessWire
require 'index.php';
// Make sure that FieldtypeRepeater is installed and ready for use
if (!wire('modules')->isInstalled('FieldtypeRepeater')) {
if (wire('modules')->isInstallable('FieldtypeRepeater')) {
wire('modules')->install('FieldtypeRepeater');
echo "Module FieldtypeRepeater installed\n";