-
Posts
807 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
The idea of easy inclusion of any custom Javascript sounds good. The module I made and use is very slim and very stable. I use it extensively, especially with hooks and the full PW API and PHP. The only Javascript I have included currently is iframe resizer.
-
Nothing ? I fixed this. Update to 1.0.9
-
[solved] adding an element to wire array during loop/iteration
kixe replied to gunter's topic in General Support
$new = new Event(5555); $s->add($new); // just prepend $s->sort("myDateTimeFieldOrWhateverSortOption"); foreach ($s as $sortedWireDataObject) { // ... } -
You have several options in the backend: 1.) Page based under Page > Settings Enable or disable every non default language. Trying to access an inactive page will result in an 404 2.) Template based under Template > Advanced (bottom) 3.) Field based under Edit Field > Details
-
it depends! // ADD PAGE // adding a page via API can be triggered by the guest user even if he has not the permission to add children under a specific parent (12464) if ($user->isGuest()) $pages->add('contribution', 12464); // works // VIEW PAGE or FIELD VALUE // if guest user has not the view permission it depends on outputformatting if ($user->isGuest()) var_dump($pages->get(12985)->title); // "I am the Page Title" if ($user->isGuest()) var_dump($pages->get(12985)->of(true)->title); // NULL // MODULES // Call of a Module via API. User has not the permission to use the module if ($user->isGuest()) $modules->get('MyModule')->execute(); // Fatal error: Exception: You do not have permission to execute this module (if debug mode is on/ 500 otherwise) if ($user->isGuest()) $modules->getModule('MyModule', array('noPermissionCheck' => true))->execute(); // works!
-
Delete cache folder. Error will be gone.
-
Assuming category is a page field I really don't understand your setup. Do you have multiple categories (pages) with the title: "Cyclonic Vacuums" under different parents? Why? So "Cyclonic Vacuums" is provided selectable in the list multiple times? 3 ways to solve this use unique titles for your categories, even if they are stored under different parents. use a custom label format in the field settings of category. e.g. {parent.title} - {title} use custom selector (screenshot)
- 1 reply
-
- 2
-
-
https://processwire.com/talk/topic/14888-simple-calendar-module-with-reservation-and-confirmation/?do=findComment&comment=133521 http://www.99lime.com/modules/recurme/ https://fullcalendar.io/
-
Do you really need it human readable? In this case GET and urlencode() is maybe a safer option. $query = "?keywords=" . urlencode('løts of special chåracters änd'); // "?keywords=l%C3%B8ts+of+special+ch%C3%A5racters+%C3%A4nd" $keywords = urldecode($input->get->keywords); // "løts of special chåracters änd"
-
Of course a good solution using the database instead of textdomain To translate globally defined strings as described in my post: go to SETUP > LANGUAGES > ITALIAN klick button "Find files to translate" select /site/translations.php start to translate
-
I do it usually as follows: 1.) Create a file /site/translations.php <?php namespace ProcessWire; /** * TRANSLATABLE STRINGS * Define globally available translatable strings * * USAGE * place this file under /site/translations.php * __("My translatable string", $ferry); * The wire property $ferry refers to the textdomain of this file * */ __("My translatable string"); 2.) Define a wire derived object and place it in /site/ready.php /** * TRANSLATABLE STRINGS * Include translatable strings * @see /site/translations.php * @var $ferry */ $this->wire('ferry', '/site/translations.php', true); output in any template /** * output in template */ echo __("My translatable string", $ferry); Now you need to translate it only once, by using the string in any template. Usecase: strings like "read more" etc. For strings specific to a template you can use simply: /** * output in template */ echo __("My translatable string");
-
[SOLVED] How to modify "Move to Trash" only for non-superusers?
kixe replied to PWaddict's topic in General Support
add this hook to your ready.php $this->wire()->addHookBefore('InputfieldCheckbox::render', function($e) { if ($e->object->id != "delete_page") return; if ($this->wire('user')->isSuperuser() == false) $e->object->label = "Hello World"; }); -
To get the options title in current user language use $type_material->getTitle(); or enable outputformatting $type_material->of(true); $type_material->get('title');
-
The idea is to generate the page name from field values and not from labels. I will not change this. But I added support for dot syntax for the options fieldtype which should feed your needs. // no fallback to default language if not set. Options should be populated in each language my_options_field.title my_options_field.value my_options_field.id // always fallback to default language. If values are set pagename is pulled from the value, otherwise from title my_options_field
- 100 replies
-
- 1
-
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
@PWaddict Sorry. I fixed the bug. Please update to 2.1.2
- 100 replies
-
- template
- autogenerate
-
(and 2 more)
Tagged with:
-
Small wish for this module which I use intensively: Option to define a selector string for newPageParent instead of selecting a fixed page. (alternatively provide option to hook in here I also recommend linking to http://modules.processwire.com/modules/admin-page-field-edit-links/ instead of http://processwire.com in module settings.
-
It works again with PHP 5.6 @ryan Thanks for providing a quick solution. ProfieldsTable is working as well. But it remains an inconsistence. https://github.com/processwire/processwire-issues/issues/729#issuecomment-433594449
-
new is a reserved word until PHP 5.6. Its not allowed to use it as a function name. PW 3.0.117 requires PHP 7.0. @ryan I strongly recommend to announce the change of the requirements. (even for the dev branch) https://github.com/processwire/processwire-issues/issues/735
-
@adrian Hi Adrian, I quickly tried your module and find it very useful. But does it work with repeater fields? I couldn't get it working ... I played a bit around and found another simple solution. config.php /** * array of pages or page trees having multilanguage disabled in the edit screen * */ $config->singleLanguagePages = array(11973 => 0, 12334 => 0); ready.php /** * disable multilanguage in Page Edit for specified pages or page trees * define array of single language pages in $config * where the key is the page id and the value defines if the page acts as a tree parent or only for a single page */ $wire->addHookBefore('ProcessPageEdit::execute', function($e) { $page = $e->object->getPage(); $slps = $this->wire('config')->singleLanguagePages; // exit if doesn't match if (empty($slps)) return; $parentIDs = array_intersect($page->parents()->prepend($page)->each('id'), array_keys($slps)); if (empty($parentIDs)) return; foreach ($parentIDs as $parentID) { if ($page->id == $parentID) break; // page matches itself if ($slps[$parentID]) break; // page is part of a single language tree return; } // page is set as a single language page $page->template->noLang = 1; // we want repeater fields single language as well foreach ($page->fields as $f) { if ($f->type instanceof FieldtypeRepeater == false) continue; $this->wire('templates')->get(FieldtypeRepeater::templateNamePrefix . $f->name)->noLang = 1; } });
-
Since PW >= 3.0.105 you can easily use the following hook. $wire->addHookBefore('InputfieldSelect::render', function($e) { if ($e->object->name != 'myfield') return; // quick exit if fieldname doesn't match $restrictedIDs = array(); // array of option values to be modified, page IDs in case of pagefield $optionAttributes = array_fill_keys($restrictedIDs, array('disabled' => 'disabled')); $e->object->addOptionAttributes($optionAttributes); }); Related commit: https://github.com/processwire/processwire/commit/07ab8ef9fcefff6a97c688599fb08fb0d462332e#diff-79808b1661a74c0668ee6157537ae478R390
- 3 replies
-
- 3
-
-
- inputfieldselect
- hook
-
(and 1 more)
Tagged with:
-
Maybe related: $page->children->sort('title') // case sensitive sort $page->children('sort=title') // case insensitive sort
-
The function getRandom() returns null if the field is empty and not an empty object. You cannot call a function from null. You need to check first if the image object exists. Make also sure your selector $targetPageId includes only pages having a field 'images'. Try this: $randomImage = !empty($pages->get($targetPageId)->images->getRandom())? $pages->get($targetPageId)->images->getRandom()->width(400) : null;
-
http://php.net/manual/en/language.oop5.decon.php __construct() is called automatically. init() not. Every property defined/ populated with __construct() is accessible inside the class/ module and outside if public. If you define properties or change their values with init() you have no access inside a function of your class without calling init() from inside this function. If you init a module the processwire way inside a template you get what you expect. EXAMPLE <?php namespace ProcessWire; class TestModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => "Test Module", 'version' => 1, ); } public $colours = array(); public function __construct() { $this->colours = array( 'Blue' ); } public function init() { $this->colours = array( 'Red', 'Orange', 'Yellow' ); } public function getColourArray() { return $this->colours; } } If you call Module/ Class via ProcessWire or directly inside your template you will get different results: <?php namespace ProcessWire; // INSTANTIATE VIA PW var_dump($modules->TestModule->getColourArray()); // init() is called by PW // array(3) { [0]=> string(3) "Red" [1]=> string(6) "Orange" [2]=> string(6) "Yellow" } // INSTANTIATE CLASS $test = new TestModule(); // the PHP way, init() is not called var_dump($test->getColourArray()); // array(1) { [0]=> string(4) "Blue" } // CALL INIT AND CHANGE RESULT $test->init(); var_dump($test->getColourArray()); // array(3) { [0]=> string(3) "Red" [1]=> string(6) "Orange" [2]=> string(6) "Yellow" }
-
I added some extra buttons to ProcessPageList. I need a quick solution to add a title attribute or option to modify the rendered markup to apply a tooltip.
-
I don't remember where I pulled this illustration from. I maybe found it somewhere here in the forum or here https://www.cmscritic.com. It corresponds largely to my personal experience. Another dimension, called 'security' is missing and would also help to make a good decision ...
- 17 replies
-
- 6
-
-
- cms
- comparison
-
(and 1 more)
Tagged with: