-
Posts
262 -
Joined
-
Last visited
-
Days Won
6
Posts posted by ukyo
-
-
1 hour ago, LAPS said:
N.B.: The module is not working. ?
Module working, but not on your side ?. I created a next branch on github repo can you download next branch and test it ?
https://github.com/trk/FieldtypeFontIconPicker/tree/next
After install module be sure, refresh modules and clear compiler cache.
-
16 hours ago, bernhard said:
@ukyo I haven't had time to look into that issue, but I'd highly recommend that you use the built in file tools of ProcessWire - that minimizes the risk of such errors and if there are still any bugs we can fix them globally on one place once for all.
It's as simple as using $this->files->find(...) in your module, see https://github.com/BernhardBaumrock/RockTabulator/blob/6670f2647fcbbb1f5ad4c5237ea9fd03b8899315/InputfieldRockTabulator.module.php#L52-L58 for example.
How to use core files()->find() function like php glob() function ?
https://github.com/trk/FieldtypeFontIconPicker/blob/master/FieldtypeFontIconPicker.module#L50
15 hours ago, LAPS said:About the $paths in the code you linked:
echo wire("config")->paths->siteModules . "**/configs/IconPicker.*.php"; // output is: /..../site/modules/**/configs/IconPicker.*.php // (manual :)) matching is: // // ftp://.../site/modules/FieldtypeFontIconPicker/configs/IconPicker.fontawesome.php // ftp://.../site/modules/FieldtypeFontIconPicker/configs/IconPicker.ionicicons.php // ftp://.../site/modules/FieldtypeFontIconPicker/configs/IconPicker.uikit.php echo wire("config")->paths->templates . "configs/IconPicker.*.php"; // output is: /.../site/templates/configs/IconPicker.*.php // no matching: // // "No such file or directory"
?
@ukyo please consider refactoring $pathss definition ASAP. ?
$path = $this->wire("config")->paths->siteModules . "**/configs/Mystique.*.php"; $path .= "," . $this->wire("config")->paths->templates . "configs/Mystique.*.php";
If you don't have custom icons inside templates folder result look like ok.
-
4 hours ago, LAPS said:
@adrian I deleted the MarkupFontIconPicker folder and I no longer get the error. Thank you! ?
It was my fault in trying to solve things ? as of the original issue: in the Edit Field > Input > Icon library, the libraries (IconPicker.*.php) are not loaded.
Is there any reason for having no loaded libraries (note: I haven't added any new libraries, I'm just using the default ones.)?
Can you check paths are true on your server ? on this line :
https://github.com/trk/FieldtypeFontIconPicker/blob/master/FieldtypeFontIconPicker.module#L43
@bernhard have similar error with my other Mystique module
Repo function line : https://github.com/trk/Mystique/blob/next/Mystique.module.php#L88
I can't find the issue. On my mac (macos mojave with valet (php 7.4.3)) and on my server (centos 7.7 with php (7.3)) i can't see this issue.
-
-
On 1/24/2020 at 3:01 PM, bernhard said:
Thx @ukyo,
it is, as I thought, a windows problem. I've tried the "next" branch - no change. It works on my linux server. Would be great to get a fix for this.
As you can see in my screenshot the strange thing is that the FilenameArray is populated on line ~118 but it is empty on line ~174 (where the select field on the input tab of the pw field should get populated).
@bernhard i don't have a Windows PC and can't test it, Can you try to change ready function for next branch :
public function ready() { $path = $this->wire("config")->paths->siteModules . "**/configs/Mystique.*.php"; $path .= "," . $this->wire("config")->paths->templates . "configs/Mystique.*.php"; foreach (glob("{" . $path . "}", GLOB_BRACE) as $file) { $dirname = dirname(dirname($file)); $base = strtolower(str_replace([dirname(dirname(dirname($file))), "/"], "", $dirname)); $name = str_replace([dirname($file), "/", "Mystique.", ".php"], "", $file); $this->resources[$base][$name] = $file; } }
with
public function ready() { $path = $this->wire("config")->paths->siteModules . "**" . DIRECTORY_SEPARATOR . "configs" . DIRECTORY_SEPARATOR . "Mystique.*.php"; $path .= "," . $this->wire("config")->paths->templates . "configs" . DIRECTORY_SEPARATOR . "Mystique.*.php"; foreach (glob("{" . $path . "}", GLOB_BRACE) as $file) { $dirname = dirname(dirname($file)); $base = strtolower(str_replace([dirname(dirname(dirname($file))), DIRECTORY_SEPARATOR], "", $dirname)); $name = str_replace([dirname($file), DIRECTORY_SEPARATOR, "Mystique.", ".php"], "", $file); $this->resources[$base][$name] = $file; } }
-
16 hours ago, bernhard said:
Hi @ukyo,
I've just tried your module for the first time, but unfortunately it does not find any resources! This is the tracy dump:
Somehow the resources array is empty:
I have the following files in my setup:
C:\laragon\www\kaum\site\modules\Mystique\configs\Mystique.example-dive.php C:\laragon\www\kaum\site\templates\configs\Mystique.mystique.php
No matter what I try - the resources select is empty:
I've even tried to do a $config->paths->normalizeSeparators() on the path without success (thought it might be a windows issue).
Thx for your help!
Hi @bernhard
Can you try @next branch https://github.com/trk/Mystique/tree/next, this will be next version.
- 1
-
I am using Contabo VPS (Germany) services since 2015 and i can recommend this company to you.
- 3
-
20 hours ago, gmclelland said:
Haven't used it yet, but I think I read that Mystique is also a good module for this kind of stuff.
I have also used SettingsFactory and can say that it works great.
Yes, it's possible to do these kind of stuff. Create 1 Mystique field and do what you want with that field.
Mystique config files
Mystique seo configs
Mystique admin edit for seo configs
- 2
-
Module update to v2. Now it's possible to add or extend existing icon library via config file.
Please check first post for example usage.
Note: Hook method removed !
- 2
-
@bernhard Thank you ! I fixed repo and thread broken images. Module allow you to add custom icons via hook and maybe i can or someone can add support for config file support like my Mystique module.
I didn't add Font Awesome 5 support, because when you load FontAwesome 5 assets, it's breaking admin icons.
-
@bernhard Nice work !
But, in module directory i have a module for pick icons. I hope you see it, before writing an icon picker.
https://modules.processwire.com/modules/fieldtype-font-icon-picker/
-
@cosmo Some of fields (image, file fields) not supported.
-
@neophron Always using this method may cause headache for you. What about add this method as property for each image field and use it like $imageField->alt. We need to add a hook method.
Add hook method to existing /site/ready.php or create new /site/ready.php, copy below code and paste it in to /site/ready.php :
/site/ready.php
<?php namespace ProcessWire; wire()->addHookProperty('Pageimage::alt', function(HookEvent $event) { /* @var $image Pageimage */ $image = $event->object; $event->return = $image->description ?: str_replace('.' . $image->ext, '', $image->basename); });
Usage ($imageField->alt) :
<?php foreach($page->images_slider as $image) { $slide = $image->size(0,700); echo "<li class='uk-width-3-4'>"; echo "<img class='photo' src='{$slide->url}' alt='{$image->alt}' width='{$slide->width}' height='{$slide->height}' />"; echo "</li>"; } ?>
- 3
- 1
-
1 hour ago, neophron said:
The image field is »array of items« with 0=no limit. And this is the code the template:
<?php foreach($page->images_slider as $slide_image) { $slide = $slide_image->size(0,700); echo " <li class='uk-width-3-4'> <img class='photo' src='{$slide->url}' alt='{$slide_image->basename}' height='700' /> </li> "; } ?>
@neophron A solution about using filename as image alt info. You can try code below :
<?php foreach($page->images_slider as $image) { $slide = $image->size(0,700); $alt = $image->description ?: str_replace('.' . $image->ext, '', $image->basename); echo "<li class='uk-width-3-4'>"; echo "<img class='photo' src='{$slide->url}' alt='{$alt}' width='{$slide->width}' height='{$slide->height}' />"; echo "</li>"; } ?>
- 3
- 1
-
@cosmo @wbmnfktr I updated module, i tested it with fresh pw 140 dev installation and i see there is problem on https://github.com/trk/Mystique/commit/b16fdba23f508c4901aeed56e71041ad34cf8c8b and removed this function.
Let me know if you still have problem ?
- 3
- 1
-
-
@bernhard if you are using ProcessWire 3 and if useFunctionsApi enabled you can call all api functions in rendered files directly.
- 3
-
7 hours ago, Jonathan Lahijani said:
Upon further inspection, setting the 'type' to 'InputfieldAsmSelect' does work and does save properly. Awesome.
Nice to hear that.
Processing input field there is not special check for input field. https://github.com/trk/Mystique/blob/master/InputfieldMystique.module.php#L135
Little bit worked on a base field type (basically this field type will get entered field type's database schemas and will create 1 database table for all entered fields), if i success about this field type, i will try to use input field based checks.
For the moment getting and setting directly posted data.
- 3
-
42 minutes ago, buster808 said:
got it working now by doing this - really need to learn php basics
<?php $content .= "<div class='uk-child-width-1-1 uk-child-width-1-3@m' uk-grid>"; ?><?phpforeach ($entries as $entry) {$content .= "<div> <a href='{$entry->url}'> <h2>{$entry->title}</h2><h4>{$publish_date}</h4></a>";$content .= shortText($entry->body, 100);$content .= "<br><a href='{$entry->url}'> Read More </a></div>";}?><?php $content .= "</div>"; ?>A tip, if your all code php in your template, you don't need to clode php tag. And no need to close and open tag again again
<?php $content .= "<div class='uk-child-width-1-1 uk-child-width-1-3@m' uk-grid>"; foreach ($entries as $entry) { $content .= "<div> <a href='{$entry->url}'> <h2>{$entry->title}</h2><h4>{$publish_date}</h4></a>"; $content .= shortText($entry->body, 100); $content .= "<br><a href='{$entry->url}'> Read More </a></div>"; } $content .= "</div>";
-
You can surround your list with grid component.
<!-- 3 columns, for 4 columns, uk-child-child-width-1-4@m --> <div class="uk-child-width-1-1 uk-child-width-1-3@m" uk-grid> <div> Blog Title 1 </div> <div> Blog Title 2 </div> <div> Blog Title 3 </div> <div> Blog Title 4 </div> <div> Blog Title 5 </div> </div>
-
I am using this module for SEO, LANGUAGE and ELEMENTS (uikit components)
USAGE EXAMPLE : LANGUAGE
On my private module, i added my custom configs path to Mystique module by using :
Mystique::add('my-module-configs-path');
- Create config file
<?php namespace ProcessWire; // Filename: MyModule/configs/Mystique.language.php // This options normally coming from a file array, i added 2 options for example $options = [ 'tr' => 'Türkçe', 'en' => 'English' ]; $defaultValue = 'en'; /** * Resource : MyModule => Language */ return [ 'title' => __('MyModule: Language'), 'fields' => [ 'title' => [ 'label' => __('Language title'), 'description' => __('Title of language'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'code' => [ 'label' => __('Code'), 'description' => __('Language short code'), 'type' => Mystique::SELECT, 'options' => $options, 'defaultValue' => $defaultValue, 'required' => true, 'columnWidth' => 50 ], 'flag' => [ 'label' => __('Flag'), 'description' => __('Language flag code'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'direction' => [ 'label' => __('Direction'), 'checkboxLabel' => __('Right to left'), 'description' => __('Direction of language'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 50 ], 'currency' => [ 'label' => __('Currency'), 'description' => __('Code of currency'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'symbol' => [ 'label' => __('Symbol'), 'description' => __('Symbol of currency'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'grouping_separator' => [ 'label' => __('Grouping separator'), 'description' => __('Thousand separator for amount'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'decimal_separator' => [ 'label' => __('Decimal separator'), 'description' => __('Decimal separator for amount'), 'type' => Mystique::TEXT, 'columnWidth' => 50 ], 'separator' => [ 'label' => __('Use separator'), 'checkboxLabel' => __('YES'), 'description' => __('Apply space between amount and currency symbol ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], 'show_decimal' => [ 'label' => __('Decimal'), 'checkboxLabel' => __('YES'), 'description' => __('Show amount decimals ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], 'symbol_after' => [ 'label' => __('Symbol after'), 'checkboxLabel' => __('YES'), 'description' => __('Display symbol after amount ?'), 'type' => Mystique::TOGGLE_CHECKBOX, 'type_fallback' => Mystique::CHECKBOX, 'columnWidth' => 33 ], ] ];
- Select config file from Mystique field settings
- Add Mystique field to language template
Access data via api (in this example mystique field name is : lang)
<?php $language = $user->language; // lang is Mystique field echo 'Title : ' . $language->lang->title . '<br>'; echo 'Code : ' . $language->lang->code . '<br>'; echo 'Flag : ' . $language->lang->flag . '<br>'; echo 'Direction : ' . $language->lang->direction . '<br>'; echo 'Currency : ' . $language->lang->currency . '<br>'; echo 'Symbol : ' . $language->lang->symbol . '<br>'; echo 'Grouping separator : ' . $language->lang->grouping_separator . '<br>'; echo 'Decimal separator : ' . $language->lang->decimal_separator . '<br>'; echo 'Separator between amount and symbol : ' . $language->lang->separator . '<br>'; echo 'Show decimal : ' . $language->lang->show_decimal . '<br>'; echo 'Show symbol after amount : ' . $language->lang->symbol_after . '<br>';
Output:
Title : English Code : en Flag : gb Direction : 0 Currency : GBP Symbol : £ Grouping separator : , Decimal separator : . Separator between amount and symbol : 1 Show decimal : 1 Show symbol after amount : 0
- 10
- 1
-
2 minutes ago, LostKobrakai said:
My question was less about the field definitions, but more about the data stored in a field defined by your module. E.g. say I want to change an integer field to a float field.
Keep the field name same, do what you want. Because all data on database in string format (i am not checking user posted data), you can set field settings by using processwire fields api and you can limit user by settings.
Hook methods could be used for custom usages.
- 2
-
6 hours ago, BitPoet said:
Maybe you could get some inspiration there from (or even improve on) my JsonNativeField module since MySQL supports searching inside JSON data.
@BitPoet will check it, but i don't want to limit user's database options and if you need an important searchable field i am not advising to use this field, use a fully searchable field.
3 hours ago, LostKobrakai said:Can you share a bit more details on how data is handled. E.g. what happens if I change a field or even remove it.
@LostKobrakai I will add more details on readme.md file and will update this post and module page.
About your question : as you see on youtube video, updating fields config file will update data entry form for admin page. If you remove field, you won't see this field on admin pages anymore. I am not caching your configs, always trying to get configs from selected config files.
- 1
-
@Sergio Updated video on youtube, its 1080p ?
- 3
FieldtypeFontIconPicker
in Modules/Plugins
Posted
Copy / Paste files enough