-
Posts
125 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Clarity
-
-
22 hours ago, Ivan Gretsky said:
@Clarity, Combo is a 1st party Pro field and it seems to be not supported out of the box with Rock Migrations. I think that only Repeater Matrix field is supported of all Ryan's Pro fields thanks to @gebeer's work. Those Pro fields all need special treatment and you can't expect them to work with just createField().
But you can always fall back to just raw ProcessWire api and create the Combo field with just that. See here how to do it if you got Pro fields support board access. If you don't, here is the code Ryan suggested (hope this is alright to post it here):
You can make a special method for Rock Migrations out of this (should be pretty easy if this code works) and make a PR if you want it there))
Thank you, it indeed works!
- 1
-
Hello!
I would like to report an issue I noticed.
I migrated a FieldtypeCombo field using the RockMigrations module. The field was transferred with the warning: FieldtypeCombo: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_global_settings_combo.i3' in 'field list'.
To figure out this error, I exported this FieldtypeCombo field and compared the database state in both cases.
After a normal export, the database looks like this:
After migrating using RockMigrations, the database looks like this:
As you can see, the database is missing columns "i3", "i4", "i5", "i6".Can you please tell me how it is possible to create them?
-
Hello!I still have a problem related to creation of repeater matrix types. There is a function:
public function createRepeaterMatrixField(string $name, array $options, bool $wipe = false) { $items = array_key_exists('matrixItems', $options) ? $options['matrixItems'] : null; if ($items) unset($options['matrixItems']); // var_dump($items); // create field $field = $this->createField($name, 'FieldtypeRepeaterMatrix', $options); // populate matrix items if ($field && wireInstanceOf($field, 'RepeaterMatrixField')) { $this->setMatrixItems($field, $items, $wipe); } return $field; }
$field variable is supposed to be RepeaterMatrixField, but it's only a Field. What I'm doing wrong? I use the code from the documentation from https://github.com/baumrock/RockMigrations/tree/dev#repeatermatrix-field. Can you please tell me why it's Field and not RepeaterMatrixField?Edit 1: I think it's field because $this->createField returns Field but not RepeaterMatrixField.Edit 2: If I use setMatrixItems, then items are being added in the second run.- 1
-
14 hours ago, Ivan Gretsky said:
It seems to be a permissions issue.
When Rock Migrations is run the regular way, it makes the $user a superuser with a sudo() method. If you run your migrations from your own script you probably need to do the same there.
Thank you, it indeed works!
-
Thanks, I was able to install the LanguageSupport module using migrate.php. But I have a question. I use this module from other script outside migrate.php. Is it possible to use this file instead of migrate.php?
-
Thank you, it works! But how to install other languages? I see only DE and FI options here.
-
-
Hello, @bernhard!
I tried to install it, but $module variable in installModule() here returns null and the installation of this module was not successful. Maybe there is something else that I don't take in account?
-
Found it: https://processwire.com/api/ref/templates/delete/.
For example,
wire()->templates->delete(wire()->templates->get('basic-page'));
-
Hello everyone!
Can you please tell me how to delete a template from database via API?
-
Hello, @bernhard!
I'm trying to install LanguageSupport module using RockMigrations with method addLanguageSupport(), but I have an error related to that module is not in the list of installable files, so I can't install it. Can you please tell me what is wrong?
-
Thank you very much!
-
Hello everyone!
I need to create a form which appears to be a filter in which GET parameters will come with the same order as the user chooses it. Can you please tell me how to do it?
-
15 hours ago, Robin S said:
I suggest replacing your Select Options field with a Page Reference field. The template for the page items would contain an integer field.
My experience is that when deciding between a Select Options field and Page Reference field, the page field is the one you want 90% of the time because pages are so much more powerful and flexible than select options. Even if the needs are simple to begin with, a page field is more future-proof. The Page Field Select Creator module makes the field setup a breeze.
Thank you, it indeed works.
15 hours ago, DV-JF said:inval($integer) or (int)$integer
Just use the code above ?
Thank you, but the select option values are still being stored as a string and $integer is already an int and doesn't need conversion.
-
Hello everyone!
I have SelectOptions field which is supposed to contain integer values for the purpose of using them in selector and compare with other integer values like this:
$pages->find('select_options.value>' . $integer)
For example, I have SelectOptions like this:
1=5|title1 2=20|title2 3=40|title3 4=60|title4 5=85|title5
So I get that values are being strings and I can't compare them with some other value. Can you please tell me how to handle it if it is possible with SelectOptions?
-
8 hours ago, Robin S said:
PW doesn't support that kind of sorting in $pages->find(), but you could use the FindMerge module and do something like this:
$base_selector = "title=foo"; $selectors = [ "$base_selector, template=template1", "$base_selector, template=template2|template3", "$base_selector, template!=template1|template2|template3", ]; $pagination_limit = 20; $results = $pages->findMerge($selectors, $pagination_limit);
Thank you, it indeed works!
- 1
-
Hello everyone!
I have a paginated PageArray and I need to sort the results first by template1, then by template2 and template3 (in any order inside 2 and 3). Then by other templates by any order. Can you please tell me how to do it?
The solution might look something like:
$pages->find('sort=(template=template1,template=template2|template3),...');
-
Also, the behavior in both Chrome and Firefox:
- First click reduces tree only to immediate children of home.
- Second click reduces tree only to home page.
But third click differs: it expands tree to immediate children in Chrome and to full previously open tree in Firefox.
-
@wbmnfktr, thank you, it indeed works.
- 1
-
Hello everyone!
In VS Code (or maybe in other IDE) by default Alt+Click on folder recursively closes tree of sub-folders if you open too many sub-folders and want to close them simultaneously. I've checked ProcessPageList.js, function clickChild(e) but haven't found a code which allows to do it for some shortcut. Can you please tell me if it is possible anyways?
-
12 hours ago, wbmnfktr said:
I'd probably do it this way.
.cards { display: flex; width: 150px; flex-wrap: wrap; /* border */ border-left: 1px solid black; border-top: 1px solid black; /* taking care of the box model */ box-sizing: border-box; } .cards__item { flex: 0 1 33%; width: 50px; height: 50px; /* border */ border-bottom: 1px solid black; border-right: 1px solid black; /* taking care of the box model */ box-sizing: border-box; }
@wbmnfktr, thank you for your variant. The only problem in it is that if we have only 1 or 2 cells, the border continues for non-existent 3rd or 2nd and 3rd element:
-
Hello everyone!
Recently I needed to construct a table using divs only:
HTML:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Border</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="cards"> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> <div class="cards__item"></div> </div> </body> </html>
CSS:
.cards { display: flex; width: 150px; flex-wrap: wrap; } .cards__item { border: 1px solid black; flex: 0 1 32%; width: 50px; height: 50px; }
The problem which I ran into is that borders are being doubled:
Then I wrote to CSS the margin:
.cards__item { border: 1px solid black; margin: -1px -1px 0 0; flex: 0 1 32%; width: 50px; height: 50px; }
Now the double borders disappear:
However, the issue in this solution is that there is a small (1px) margin to the right of table. Can you please tell me how I can do something better for this?
-
@gebeer, thank you for improving my scripts. I've updated them.
5 hours ago, gebeer said:Thanks for sharing. Your 2nd example can also be written like this
$fieldName = 'content_product'; $typeName = 'product_downloads'; $pagesWithType = $pages->find("{$fieldName}.type={$typeName}"); db($pagesWithType);
Also my previous version of this script finds pages in repeaters which is not an intended behavior.
- 1
-
@bernhard, yes, of course. I've added screenshots.
- 1
Menu Builder
in Modules/Plugins
Posted
Hello, @kongondo!
I use the module in this way: I'm creating a site with possibility of creating blank menu without items.
On these lines I'm trying to get menu items:
Then I get an error: "No menu items found! Confirm that such a menu exists and that it has menu items." if items are not present. This is caused by the line 1366:
https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366
I tried to fix it manually using the fact that the menu is a page and menu items are being stored in menu_items variable:
However, it seems to be only a workaround. Am I using module correctly? If no, how can I use it to avoid such an error without adding items?
If it is not possible, I suggest the following fix:
Here https://github.com/kongondo/MenuBuilder/blob/main/MarkupMenuBuilder.module#L1366 return can be replaced from $this->throwError() to [] or array().
I created a new issue here: https://github.com/kongondo/MenuBuilder/issues/50. Can you please see this issue?