Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by ukyo

  1. @aagd I pushed an update, this update has fix for attributes to string fix and added an example component. This component contains example on readme file with 2 different output solution. Method 1 is commented https://github.com/trk/Component/blob/8b973cca955a29fd60c933da9ff9a6d35f5e518b/components/example/templates/template-default.php#L11 Method 2 classic way https://github.com/trk/Component/blob/8b973cca955a29fd60c933da9ff9a6d35f5e518b/components/example/templates/template-default.php#L24
  2. Hi @aagd Example code is combination of https://getuikit.com/docs/heading and https://getuikit.com/docs/text. Size, decoration, transform, color and align params adds classes to component. If you include uikit 3 on your project or if you check the output. You will see the result on component output.
  3. @MarkE The general problem in page builders is what frontend framework support they offer. Does the frontend framework support they provide align with your design, or do you need to learn and adapt to this frontend framework? The same problem exists in ProcessWire as well. When we want to use the fields on the frontend, we often need to make numerous modifications to achieve the desired results. I also have my own page builder structure created using the PageTable module, and I've been using this structure for about six years, continuously updating it on my end. The primary reason for creating the Mystique module is to dynamically create custom fields within the page builder and manage them as I like. My custom page builder is built on the Uikit 3 framework, but when I want to use Tailwind CSS or Bootstrap in the frontend, the current system doesn't support this. One of the reasons is that I primarily use the Component module and have created a separate module called UikitComponent to configure Uikit components within this module. I aim to apply this for Bootstrap, Tailwind CSS, or any other frontend framework or design. In addition to this, another fundamental reason for writing the Component module is to be able to provide readable and understandable outputs for the requests sent to the page in the HTMX module that I am preparing for publication. In the project I'm working on, I'm using the HTMX, Component, and Mystique modules together. I created a component called 'product-list' and added extra settings to this component, including 'element' => true and 'fields' => array(). In the 'fields' section, I added configuration settings for the Mystique module. I added the 'element' => true setting to use this component in my page builder, making it accessible both in the code and through the admin panel. This way, the component can be used on the code side and added to the desired location by the administrator through the admin panel. Also you can check a javascript solution: https://github.com/codex-team/editor.js I wrote a module and have some experience with this. Output is clean json data Ekran Kaydı 2023-10-12 13.33.49.mov
  4. Module help you to create and use set of components to utilize in your ProcessWire. You can find more info and an examples on Github repo : https://github.com/trk/Component/tree/main
  5. This seems like the most reasonable solution. When pages are updated or deleted, the data will be automatically updated or removed. I can manage the templates and fields that will be cached easily through module settings. The desired fields and templates are cached, while other fields and templates continue to function as usual in ProcessWire. I have three reasons for obtaining the raw JSON output: 1. To fetch the data and display it directly in the desired format. I don't want the data to be influenced by HTML, so I can use it anywhere. 2. To generate static pages using the data (using libraries like Astro.js). 3. To make the saved data accessible for other applications through an API.
  6. When using this method, the data is retrieved in its raw form. It requires further processing to display the data. When $page->title is called, the data is initially fetched from the database using this method and undergoes certain operations before appearing as $page->title. The part I want to intervene in is as follows: If the data is present in the saved JSON, show it directly without processing; otherwise, retrieve the data from the database, process it, and display it.
  7. Sure, However, I don't want to make any changes to regular page displays. When this option is enabled in the module settings, I want it to directly reflect on the page. I am looking for a solution while continuing to use the normal page API. When I use $page->title and if the transfer is enabled for the title field in the module settings and it has been saved as JSON, I want this information to come from the JSON data. When I remove the title field from the module settings, I want this information to be retrieved and displayed using SQL.
  8. When I checked a page I created with ProcessWire, I noticed that it was using a lot of SQL queries when displaying a page (600+ SQL queries). This page contains a page builder and similar page links from other pages. The number of queries seemed excessive to me, and I believe it is because a separate table is created for each field. Therefore, I have observed that the number of SQL queries increases based on the number of fields when accessing page data. To address this issue, I have implemented a solution where I save or delete the page data as JSON when the page is saved or deleted (I also want to use this module when generating static pages). If a field needs to be displayed on the page, I want it to be shown from the JSON output if it exists there, otherwise I want it to be retrieved with an SQL query.
  9. I want to track and modify all called $page->* (fields) properties, before property get a value or after property get a value. is it possible to do it with a method like hooks ?? like: id, title, body, image <?php $wire->addHookProperty('Page::*,Page::[id,title,body,image]', function(HookEvent $e) { $page = $e->object; // How to get name of property ??? $property = '???'; $isCached = true; if ($isCached) { $cachedValue = 'Cached value from somewhere'; $value = $cachedValue; } else { $value = $page->get($property); } if ($property === 'title') { $value = "<h1>{$value}</h1>"; } $e->return = $value; });
  10. @zoeck wire()->addHookAfter('InputfieldRepeater::render', function (HookEvent $e) { /** * @var InputfieldRepeater $repeater * @var Page $page Repeater page */ $repeater = $e->object; $page = $repeater->hasPage; if ($repeater->getAttribute('name') == 'repeater_name') { $return = $e->return; $e->return = $return . 'Hello World !'; } });
  11. @bernhard Did you try htmx ? on validation side, i am using https://www.sirius.ro/php/sirius/validation/ and https://www.sirius.ro/php/sirius/upload/ you can use PHP for process, only you need some attributes for form element (no need javascript). you can redirect page with headers here is an example with htmx and processwire htmx-form.mov
  12. Be sure you selected your resource name from your input config and be sure you saved your input config
  13. ukyo


    This module help you to organize your events in files. Module using CORE hook system. After i wrote many events inside my module, it was confused to find what is where. After that i think to write a EventLoader module for separate events in files and load them by using a prefix like `ready.` or `init.`. Think, you have api, page method, page property etc. events on your /site/ready.php file or module. If you write all of these events on a single file, it could be hard to find what is where. At this point you can separate your events inside event files. I will write 2 example file, may you have 5 - 15 or more event files and all file may have events more than 1. /site/templates/configs/events/ready.api.php <?php namespace ProcessWire; /** * Api calls **/ return [ 'events' => [ '/hello/world' => [ 'fn' => function (HookEvent $e) { return 'Hello'; } ], '/hola/world' => function (HookEvent $e) { return 'Hello'; }, '/hello/(earth|mars|jupiter)' => [ 'fn' => function (HookEvent $e) { return "Hello " . $event->arguments(1); } ], '/hola/(earth|mars|jupiter)' => function (HookEvent $e) { return "Hello " . $event->arguments(1); } ] ]; /site/templates/configs/events/ready.page.php <?php namespace ProcessWire; return [ 'events' => [ 'Page::hello' => [ 'type' => 'method', 'fn' => function (HookEvent $e) { $message = is_string($e->arguments(0)) ? $e->arguments(0) : ''; $e->return = $message; } ] ] ]; Loading /site/ready.php events from event files <?php namespace ProcessWire; if(!defined("PROCESSWIRE")) die(); // this will load all event files, starts with `ready.` prefix // __DIR__ . '/templates' => /processwire-root/site/templates/configs/events/ EventLoader::load(__DIR__ . '/templates', 'ready.');
  14. Module allow you to load events from event files. Visit Github page or module directory for usage
  15. Did someone have a idea about Viewi ?
  16. Mytqiue works inside repeater fields. If you mean, create repeater field via Mystique, the answer is no.
  17. Basically <?php namespace ProcessWire; // create field $field = new Field(); $field->name = 'my_field'; $field->label = 'My Field'; $field->type = 'FieldtypeText'; // save field wire('fields')->save($field); // get field $field = wire('fields')->get('my_field'); // Create fieldgroup $fieldgroup = new Fieldgroup(); // if you want to edit fields in this field group via admin panel, name need to be same with template name $fieldgroup->name = 'my_template'; $fieldgroup->add('title'); $fieldgroup->add('body'); $fieldgroup->add($field); // save fieldgroup wire('fieldgroups')->save($fieldgroup); // get fieldgroup $fieldgroup = wire('fieldgroups')->get('my_template'); // Create template $template = new Template(); $template->name = 'my_template'; $template->label = 'My Template'; $template->fieldgroup = $fieldgroup; // save template wire('templates')->save($template); // get template $template = wire('templates')->get('my_template');
  18. @Clarity @Jonathan Lahijani I pushed a fix, can u update next branch and try ? Entering language based data, Exporting and importing Mystique field data Video result Ekran Kaydı 2021-10-08 22.46.51.mov
  19. I have many web projects using mystique fields, i didn't see an error like this. You can make a try with clean processwire install, after that if this error continue for your create an issue on github repo.
  20. Yes, json or php file. I see my mistake on readme.md i will fix it. {Mystique.*.php,mystique.*.php,Mystique.*.json,mystique.*.json} Long time i am not working with master branch, i have many updates on next branch, i will merge these 2 branch soon.
  21. @Ivan Gretsky You can also try next version of Mystique field type. Now, its possible to display custom fields depend on template name or page, you imagine it. Here is an example usage: <?php namespace ProcessWire; /** * Resource: magic of mystique field */ return function ($page = null, $field = null, $value = null) { $fields = [ 'hello' => [ 'label' => 'Are you ready for a Magic ?', 'type' => 'select', 'options' => [ 'no' => 'No', 'yes' => 'Yes' ], 'required' => true, 'defaultValue' => 'no' ] ]; if ($page instanceof Page && $page->template->name == 'page') { $fields['current_page'] = [ 'label' => 'Current page title : ' . $page->title, 'value' => $page->title, 'showIf' => [ 'hello' => '=yes' ], 'columnWidth' => 50 ]; } if ($field instanceof Field) { $fields['current_field'] = [ 'label' => 'Current field label : ' . $field->label, 'value' => $field->label, 'showIf' => [ 'hello' => '=yes' ], 'columnWidth' => 50 ]; } return [ 'name' => 'magician', 'title' => 'Do A Magic ?', 'fields' => $fields ]; };
  22. This should work <?php $page->of(false); $page->mystique_field_name->property1 = 'data'; $page->mystique_field_name->property2 = 'data'; $page->mystique_field_name->property3 = 'data'; $page->mystique_field_name->property4 = 'data'; $page->mystique_field_name->property5 = 'data'; $page->mystique_field_name->property6 = 'data'; $page->save();
  23. @szabesz No need new Module for Uikit source files ! Node example only for theme development, if you need admin theme customizations you can import uikit source files on your side. Node usage example is not for ProcessWire users, its only for theme development by @ryan or @bernhard. User can import uikit source files inside : /site/templates/admin.less You can add @uikit-source-path variable on wire/modules/AdminTheme/AdminThemeUikit/uikit-pw/pw.less You can change variable value normally on lately loaded file on less. // Import uikit, use less variable for uikit source @uikit-source-path: "../../node_modules/uikit/src/less/uikit.less" @import $uikit-source-path; Change @uikit-source-path variable /site/templates/admin.less @uikit-source-path: 'source/to/uikit/less/uikit.less'; div { border: 1px solid red; }
  24. @bernhard @ryan Thanks for admin theme customization option But i didn't like uikit source files under AdminThemeUikit/uikit, no need these files. Folder size is big ! I can give an idea about using uikit less or scss files: - You can install uikit via node with package.json file - You can load source uikit files from node_modules/uikit/src/less/uikit.less - You can add node_modules folder to .gitignore - If a user want to modify admin theme, user can define uikit source from less file With this way, we don't need uikit source files under AdminThemeUikit folder
  • Create New...