Jump to content

PWaddict

Members
  • Posts

    936
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by PWaddict

  1. Thank you @Juergen You accidentaly placed the old Hooking example 2 on the docs which now the font awesome icon displayed always even if there are no errors. Replace it with the above hook which works properly.
  2. Yep, now this hook works: $wire->addHookAfter('Label::renderAsterisk', function(HookEvent $event) { $event->return = '<span class="myAsterisk">+</span>'; }); Please fix Errormessage::render too.
  3. I'm testing it on a brand new website and my init.php doesn't have any other hook. If I change the hook to Page::render it works so it seems it's not a PW issue. <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); /** @var ProcessWire $wire */ /** * ProcessWire Bootstrap Initialization * ==================================== * This init.php file is called during ProcessWire bootstrap initialization process. * This occurs after all autoload modules have been initialized, but before the current page * has been determined. This is a good place to attach hooks. You may place whatever you'd * like in this file. For example: * * $wire->addHookAfter('Page::render', function($event) { * $event->return = str_replace("</body>", "<p>Hello World</p></body>", $event->return); * }); * */ wire()->addHookAfter('Form::render', function ($event) { $return = $event->return; $return = str_replace('<span class="asterisk">*</span>','<span class="myAsterisk">+</span>', $return); $event->return = $return; });
  4. I tried the new hook on both init.php and ready.php but still not working. wire()->addHookAfter('Form::render', function ($event) { $return = $event->return; $return = str_replace('<span class="asterisk">*</span>','<span class="myAsterisk">+</span>', $return); $event->return = $return; });
  5. No, I'm talking about the TinyMCE autolink plugin. You can find it on the Input tab.
  6. Is it possible to edit the rows attribute of the textarea? Can I add / remove input attributes? Sorry, I somehow missed the info about setAttribute() and removeAttribute().
  7. Hmm... it seems that it only works if you press "space" after typing www.example.com Back to good old TextformatterMakeLinks module 😎
  8. Hello. I have activated the "autolink" plugin on a TinyMCE textarea field but it doesn't create hyperlinks. On body I typed www.example.com and it still outputs as plain text. I'm new to TinyMCE so I'm not sure if I'm doing something wrong or autolink is broken.
  9. @Juergen congrats for your module. I installed it today for the first time and while doing some tests I noticed that hooks doesn't work. I'm trying to add a font awesome icon on the error message with the hooking example you have on readme but it's not working. I tested also the other example for hooking on label's asterisk and doesn't work either.
  10. Hi there. I'm using ProcessWire on Litespeed servers for 10+ years. There are NO compatibility issues. Everything you do with regular Apache you can do on Litespeed too. Google "Litespeed vs Apache" and you can easily find out why you should stay with Litespeed 🙂
  11. Hello, I'm outputing repeater content in ProcessWire way like this instead of the classic foreach. <?= preg_replace('/(.*),/','$1 &', $page->datetimes->implode(", ", "{day} {time_start}-{time_end}")) // Monday 19:00-21:00, Tuesday 19:00-21:00 & Wednesday 19:00-21:00 ?> Is there a ProcessWire way to output the content like below where if the time_start and time_end have the same values on all days then display them only once at the end of the string: Monday, Tuesday & Wednesday 19:00-21:00
  12. Yep, Stripe is easier because it has way much better documentation than PayPal. @bernhard You will probably get more help by checking out my PayPal module than looking at the PayPal documentation.
  13. That's great. Stripe Seamless Integration Stripe Payment Element PayPal Seamless Integration PayPal Standard Checkout PayPal Advanced Checkout
  14. @bernhard Mollie is supported ONLY on 32 countries and half of them are required to have a minimum sales volume. You will instantly exclude potential customers from many countries including USA. More info here. Stripe is supported on 50 countries and PayPal on more than 200. I think it will be better if you create a system with external payment modules where the RockCommerce clients will be able to use your ready-made payment modules for Mollie, Stripe, PayPal or they can create their own for any other payment provider. I don't know if Mollie supports it but PayPal and Stripe supports seamless integration too. The user completes the payment without leaving the client's website which is by far the best solution. I'm still a Padloper 1 user and created my own modules to do that for PayPal and Stripe (I haven't released it yet).
  15. Unfortunately that way if a site editor edit the custom page and the superuser never edited it before, the default field value from construct method will not get saved. Feel free to check my process module code here.
  16. Hello! How can I set access to superuser only to a field that is created programmatically and doesn't belong to any template? Here is the code of the field that is part of a process module where that field is accessed by a custom page under setup: $field = $modules->get('InputfieldText'); $field->attr('name', 'myfield'); $field->label = $this->_('My Field'); $field->attr('value', $this->myfield); $form->add($field);
  17. Thanks @poljpocket I've edited the code on my post above.
  18. Thank you for the replies. @poljpocket yep I misunderstood it indeed but I figured it out. I had to make the Process module as ConfigurableModule even with no config fields so I can save the values from my programmatically fields of buildForm() to module's database field "data" by using getConfig() and saveConfig(). Here is a full code sample: <?php namespace ProcessWire; class ProcessModuleTest extends Process implements ConfigModule { public static function getModuleInfo() { return array( 'title' => 'My Process Module', 'summary' => 'Setup My Process Module', 'version' => 100, 'icon' => 'cog' ); } public function __construct() { parent::__construct(); $this->set('my_text_field_1', ''); $this->set('my_text_field_2', ''); } public function ___execute() { $form = $this->buildForm(); if($this->input->post('submit_save')) { $this->processForm($form); $this->session->redirect('./'); } return $form->render(); } protected function ___processForm(InputfieldForm $form) { $input = $this->wire('input'); $data = $this->wire('modules')->getConfig($this); $form->processInput($input->post); $data['my_text_field_1'] = $form->getChildByName('my_text_field_1')->val(); $data['my_text_field_2'] = $form->getChildByName('my_text_field_2')->val(); if(count($form->getErrors())) return; $this->wire('modules')->saveConfig($this, $data); $this->message($this->_('Saved My Process Module Settings')); } protected function ___buildForm() { $modules = $this->wire()->modules; $form = $modules->get('InputfieldForm'); $form->attr('id', 'ProcessModuleTest'); $form->attr('method', 'post'); $form->attr('action', './'); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field_1'); $field->label = $this->_('My Text Field 1'); $field->attr('value', $this->my_text_field_1); $form->add($field); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field_2'); $field->label = $this->_('My Text Field 2'); $field->attr('value', $this->my_text_field_2); $form->add($field); $submit = $modules->get('InputfieldSubmit'); $submit->attr('value', $this->_('Submit')); $submit->attr('id+name', 'submit_save'); $form->add($submit); return $form; } protected function getInstalledPage() { $admin = $this->pages->get($this->config->adminRootPageID); $parent = $admin->child("name=setup"); if(!$parent->id) $parent = $admin; $name = 'my-process-module'; $page = $parent->child("name=$name"); if(!$page->id) { $info = ProcessModuleTest::getModuleInfo(); $page = new Page(); $page->parent = $parent; $page->template = 'admin'; $page->name = $name; $page->title = $info['title']; $page->icon = $info['icon']; $page->process = $this; $page->sort = $parent->numChildren; $page->save(); } return $page; } public function ___install() { parent::___install(); // Process modules must call parent method $page = $this->getInstalledPage(); $this->message(sprintf($this->_('Installed to %s'), $page->path)); } public function ___uninstall() { parent::___uninstall(); // Process modules must call parent method $page = $this->getInstalledPage(); if(!$page->id) return; $this->message(sprintf($this->_('Removed %s'), $page->path)); $this->pages->delete($page); } } Then on the frontend I can get a field value like that: echo $modules->getConfig('ProcessModuleTest', 'my_text_field_1');
  19. Hello! I'm trying to create a Process module where the fields need to be on the custom Process page (under Setup) instead of the module screen. Here is my code so far and the problem is that the value on the field doesn't getting saved. Any help? <?php namespace ProcessWire; class ProcessModuleTest extends Process { public static function getModuleInfo() { return array( 'title' => 'My Process Module', 'summary' => 'Setup My Process Module', 'version' => 100, 'page' => array( 'name' => 'my-process-module', 'title' => 'My Process Module', 'parent' => 'setup', ) ); } public function ___execute() { $form = $this->buildForm(); if($this->input->post('submit_save')) { $this->processForm($form); $this->session->redirect('./'); } return $form->render(); } protected function ___processForm(InputfieldForm $form) { $input = $this->wire('input'); $form->processInput($input->post); $this->message($this->_('Saved!')); } protected function ___buildForm() { $modules = $this->wire()->modules; $form = $modules->get('InputfieldForm'); $form->attr('id', 'ProcessModuleTest'); $form->attr('method', 'post'); $form->attr('action', './'); $field = $modules->get('InputfieldText'); $field->attr('name', 'my_text_field'); $field->label = $this->_('My Text Field'); $form->add($field); $submit = $modules->get('InputfieldSubmit'); $submit->attr('value', $this->_('Submit')); $submit->attr('id+name', 'submit_save'); $form->add($submit); return $form; } }
  20. FontAwesome Upgrade ProcessWire's backend with the latest Font Awesome free icons (solid + brands). Install Link: https://github.com/PWaddict/FontAwesome Copy all files included in this module into new directory /site/modules/FontAwesome/. In the ProcessWire admin, go to Modules > Refresh. Click install for the Font Awesome module. IMPORTANT: The module has a duplicated folder of the core's InputfieldIcon module where only 2 files (icons.inc, InputfieldIcon.js) have been modified so you must select the InputfieldIcon version from Font Awesome module to load. To do that go to InputfieldIcon module screen by using search or refreshing modules (you will get the duplicated notification) and on the section "Module file to use" select the proper version and click on Submit button.
  21. Thank you guys for the suggestions. Since I don't have the ProDevTools module yet I will try @bernhard's idea soon.
  22. Hello! Let's say an admin is editing a product page that contains a quantity field with the value "10". During that time a user is completing an order with the product that currently the admin is editing and the quantity field value is changed programatically to "9". All good so far. Here is the problem: If the admin finished editing the page and press Save, the quantity field value will be changed back to "10" even though he didn't touched that value as that was the value when he opened the page to edit. How can I prevent this? How do you solve this issue?
  23. Nevermind, I just saw the following note on PadCart.module (Padloper 1) so I guess you can easily have multiple carts on both Padloper versions by duplicating PadCart.module and renaming it's Class and $dbname value ? 'singular' => false, // You can have multiple carts available EDIT: Probably, I will also have to duplicate more files like PadLoper.module, PadOrderProcess.php, PadOnePageCheckout.module and change their $this->cart values.
×
×
  • Create New...