-
Posts
1,045 -
Joined
-
Last visited
-
Days Won
11
Zeka last won the day on February 3
Zeka had the most liked content!
About Zeka
- Birthday 04/12/1989
Profile Information
-
Gender
Male
-
Location
Kyiv, Ukraine
Recent Profile Visitors
4,172 profile views
Zeka's Achievements
-
Hi @JerryDi I would recommend getting to know with 'owner' selector as it could be beneficial in the setups Ryan provided. https://processwire.com/blog/posts/processwire-3.0.95-core-updates/
-
As an option https://processwire.com/blog/posts/pw-3.0.173/#telling-processwire-what-page-to-render
-
Preventing file compiler during 2.x to 3.x upgrade?
Zeka replied to MarcC's topic in General Support
https://github.com/processwire/processwire/blob/master/wire/config.php#L516 -
Hi @Matzn <?php namespace ProcessWire; class ParentModule extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return [ 'title' => 'Parent Module', 'version' => 1, ]; } const defaultValue = '12345'; public function __construct() { $this->set('api_user', self::defaultValue); // set default value in construct } public function getApiUser() { return $this->api_user; } public static function getModuleConfigInputfields(array $data) { if(!isset($data['api_user'])) $data['api_user'] = self::defaultValue; $form = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldText'); $f->name = 'api_user'; $f->label = 'API USER'; $f->value = $data['api_user']; $form->add($f); return $form; } } <?php namespace ProcessWire; class ChildModule extends ParentModule { public static function getModuleInfo() { return [ 'title' => 'ChildModule', 'version' => 1 ]; } public function __construct() { parent::__construct(); bd($this->getApiUser()); bd($this->wire()->modules->getModuleConfigData('ParentModule')); } } Take a look at the construct method of ChildModule. Without calling parent::__construct you will not be able to get what you want. Also you can use $this->wire()->modules->getModuleConfigData('ParentModule') to get config data of module.
-
Hi @prestoav Try to output this https://processwire.com/api/ref/session/get-all/
-
Accessing previous version of page before/after page save
Zeka replied to Pete's topic in General Support
Not sure, but probably getFresh method is applicable in such a case. https://processwire.com/api/ref/pages/get-fresh/ -
https://processwire.com/docs/modules/hooks/#how-can-i-add-a-new-method-via-a-hook
-
Hi @theoretic You are adding a property via hook instead of method https://processwire.com/api/ref/wire/add-hook-method/
-
There is no built-in functionality. The simplest way is to create addtional fields like 'page_views' and 'page_popularity', then populate these fields inthe desirerable way and use them in your selectors like pages('template=post, sort=-page_views');
-
Why just not create a text field like 'externa_id' and then check it while import like foreach ($import_records as $import_record) { $exists = $this->wire()->pages->has("template=some-template, external_id=" . $import_record['unique_id']); if($exists) { // update } else { // create a new page } }
-
Hi @swissdoode . Take a look at Inputfields.js file, there are many methods that you could find helpfull https://github.com/processwire/processwire/blob/dev/wire/templates-admin/scripts/inputfields.js#L37
-
Return json from __execute in backend module
Zeka replied to toni's topic in Module/Plugin Development
Hi @toni. Process modules is intended to be used in admin and they are not autoloaded, so for such hook you can create an satelite autoload module or put this code to init.php file. class URLHooker extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'URLHooker', 'version' => '0.1', 'singular' => true, 'autoload' => true, 'requires' => [ 'YourProcessModule>=0.1' ], ); } public function init() { $this->wire()->addHook('/hello/world', function($event) { return 'Hello World'; }); } } -
Also take a look at ProcessHello module https://processwire.com/modules/process-hello/ https://processwire.com/blog/posts/pw-3.0.181-hello/ https://github.com/ryancramerdesign/ProcessHello
-
https://github.com/processwire/processwire/blob/dev/wire/core/ProcessController.php#L388