-
Posts
4,932 -
Joined
-
Days Won
321
Everything posted by Robin S
-
@bernhard, this looks like a really useful module, thanks for making it. When using FieldtypeHandsontable values as part of a $pages->find() selector, is it possible to search for values in particular column or row, or in a specific column/row combination? Like in the "row headers" example in the first post, is it possible to match pages where "Juni 2018 = 60"?
-
Surely you don't want/need all 10000 items in the table at once. You could emulate the way that Lister works. A paginated table where the filter/sort options use AJAX requests and then PW selectors on the server side.
-
PW 3.0.66 & “Functional Fields” module released
Robin S replied to ryan's topic in News & Announcements
Functional fields sound awesome! Seeing as both of these may be used as the first argument... __text('Subscribe') // intended to be some default text __text('subscribe') // intended to be the name previously given to some different text ...is it right that you would have to be careful when giving a name to text to make sure it is not a string that might be used as default text, now or in the future? Like, maybe you would want to prefix the name with something that is unlikely to be used as default text. And in the example above, would those two be identified as separate text items - i.e. is the name case-sensitive? -
Thanks for letting me know. I have updated the module to set a minimum version requirement for FieldtypeRepeaterMatrix.
-
Markup CKEditor (for Form Builder) An inputfield for displaying markup editable via CKEditor. The module is intended for use with the Form Builder module. Allows blocks of static text to be included within a form, which can be edited in the form settings using CKEditor. Screenshots Usage Install the Markup CKEditor module. In the Form Builder module settings, add "MarkupCKEditor" to "Inputfield types to use with FormBuilder". In your form settings, add a new field of type "Markup CKEditor". Enter the text you want to show in this field using "Markup Text" on the "Details" tab. Configuration In the module config you can set items for the CKEditor toolbar that will apply to all Markup CKEditor fields. If you want to insert images in your markup field then add "Image" to the toolbar items to enable the standard CKEditor image plugin. The ProcessWire image plugin is not usable because in a FormBuilder form there is no page to store images in. Advanced There is a InputfieldMarkupCKEditor::ckeReady hookable method for users who want to do advanced customisation of the CKEditor inputfield. It receives three arguments: The InputfieldCKEditor object The form as a FormBuilderForm object The field as a FormBuilderField object Example $wire->addHookAfter('InputfieldMarkupCKEditor::ckeReady', function(HookEvent $event) { /** @var InputfieldCKEditor $cke */ $cke = $event->arguments(0); /** @var FormBuilderForm */ $form = $event->arguments(1); /** @var FormBuilderField $field */ $field = $event->arguments(2); if($form->name === 'test_form' && $field->name === 'my_cke_markup_field') { $cke->contentsCss = '/site/templates/MarkupCKEditor/contents.css'; $cke->stylesSet = 'ckstyles:/site/templates/MarkupCKEditor/ckstyles.js'; } }); http://modules.processwire.com/modules/inputfield-markup-ckeditor/ https://github.com/Toutouwai/InputfieldMarkupCKEditor
- 17 replies
-
- 13
-
- module
- form builder
-
(and 1 more)
Tagged with:
-
Thanks @Roope! The hook didn't work within the page template (maybe too late there) but did work in /site/ready.php
-
@bernhard, for module AJAX calls I have used a replace hook on ProcessModule::executeEdit. In my JS I send an AJAX request to the module's config page, and in the hook I check that the request is coming via AJAX and has the required GET/POST variable(s) and if so I use $event->replace = true and return my response.
-
@cjx2240, sorry to hear that. Can you give some more information please... Is the "who_we_are" field a Repeater Matrix field? Do you have the latest version of Repeater Matrix installed - v0.0.4? Do you have debug mode enabled in /site/config.php? If not please enable and let me know if you see any error messages when you try and edit the field. If you don't see any error messages still, please install Tracy Debugger, tick the "Backend" option for "Show Debug Bar", and check for errors when you try and edit the field, as in the screenshot below: Thanks.
-
It's a bug: https://github.com/processwire/processwire-issues/issues/302
-
Thanks, this works well. Short and sweet so will go with this. It does work, thanks. Although in my case I don't want to change the sort order beyond moving portrait images to the end so modified it to: foreach($page->listing_images as $image) { if($image->height() > $image->width()) { $image->aspect = 2; } else { $image->aspect = 1; } } $page->listing_images->sort('aspect');
-
Here is an example - change the template name to suit. Assumes three integer fields: quantity, unit_price, order_total. In /site/ready.php... $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template->name !== 'your_template_name') return; if($page->quantity && $page->unit_price) { $page->order_total = $page->quantity * $page->unit_price; } });
-
You can create a new integer field, add it to your template, and update the value based on other values in the page with a hook to Pages::saveReady. No need for a new fieldtype I think because it would have to use a hook like this anyway, because by themselves fields don't know anything about other fields that might be in the same template.
-
Hi @Roope, Love this module - it's used in all my sites. Is it possible to disable the module on some pages via a hook? I need to disable the obfuscation when a particular GET variable is present.
-
I want to reorder my Pageimages array so that portrait-format images are placed last. Currently I'm removing portrait-format images and then adding them back. $listing_images = $page->listing_images; foreach($listing_images as $listing_image) { /* @var Pageimage $listing_image */ if($listing_image->height() > $listing_image->width()) { $listing_images->remove($listing_image); $listing_images->add($listing_image); } } This works, but just wondering if there is some better WireArray method I could use that works like "move this item to the end of the array".
-
Rather than edit the DB for an existing field, you could make a simple fieldtype module that extends FieldtypeTextarea: <?php class FieldtypeLongTextarea extends FieldtypeTextarea { /** * Module information */ public static function getModuleInfo() { return array( 'title' => 'Long Textarea', 'version' => 1, 'summary' => 'Field that stores multiple lines of text in a MySQL LONGTEXT column type.', ); } /** * Get database schema used by the Field * * @param Field $field * @return array * */ public function getDatabaseSchema(Field $field) { $schema = parent::getDatabaseSchema($field); $schema['data'] = 'longtext NOT NULL'; $schema['keys']['data'] = 'FULLTEXT KEY data (data)'; return $schema; } }
-
Welcome @fabjeck, Having different markup for different templates is what the markup regions feature is all about. First, make sure you are up-to-speed with markup regions by reading the related blog posts: https://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/ https://processwire.com/blog/posts/processwire-3.0.50-core-updates/ https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ Regarding the #content markup in _main.php and your "normal" template file (let's say it is called "basic-page.php") there are two approaches - either is fine; it's just whatever you find easier to manage. Note that I am only showing a portion of _main.php below - this file needs to include complete HTML page markup: doctype, <head>, <body>, etc. Approach 1: put your normal #content markup in _main.php and leave basic-page.php empty of markup. _main.php <div id="content"> <!-- Your normal markup here --> <h1><?= $page->title ?></h1> <!-- etc --> </div> basic-page.php - no markup Approach 2: put an empty #content region in _main.php and put your normal markup in basic-page.php _main.php <div id="content"></div> basic-page.php <div id="content"> <!-- Your normal markup here --> <h1><?= $page->title ?></h1> <!-- etc --> </div> And in either approach, your home.php is the same: <div id="content"> <!-- Your home markup here --> <section> <div class="slider"> <!-- Find and output some news pages using a selector --> </div> </section> <section> <div class="news"> <!-- Find and output some news pages using a different selector --> </div> </section> </div>
-
Maybe a Javascript error - anything showing in your dev tools console?
-
Then they are not a company that deserves your money. Time to vote with your wallet and move to a new host.
-
Hi @adrian, everything is working as expected thanks - just took me a moment to connect the dots that no Tracy debug bar = no Tracy methods available (which makes sense). Great to have you back around here!
-
Welcome @obesegiraffe, Not sure that this could be the cause of the problem, but the way you are checking if the Options field is populated looks a bit unusual to me. Does it make a difference if you use count() instead? <?php if(count($page->percent_leased)){ ?> <h2><?=$page->percent_leased->title?>% Leased</h2> <?php } ?> The database table looks like what you get if your Options field is set to one of the "Multiple values" inputfields. If you have changed the input type from Multiple to Single at some point then you would need to save each of the pages in admin that had any multiple values saved for it in order to trigger the value to update.
- 2 replies
-
- 1
-
- select options
- options
-
(and 1 more)
Tagged with:
-
Welcome @Cabcom, Sure it is possible, but not a simple task. You'd be looking at something like the following: Create elements (divs or whatever) in the front-end that represent your repeater items (probably using repeater item page ID as an identifier). Use some Javascript on the elements that supports drag-and-drop sorting - I'm sure there are a number of off-the-shelf solutions for this. When a submit button is clicked, submit an array of the the repeater item IDs in the current sort order to a ProcessWire page (using a form or AJAX). In the template for that page, get the submitted array and apply the sorting to the repeater field using the API. It might be easier to remove all items from the field and then add the items back in the array order than to try and adjust the sorting of the items already in the field. If you are up for the challenge I'm sure you'll find help here in the forums if you get stuck on a step.
- 1 reply
-
- 2
-
"published" and "modified" always have the same value
Robin S replied to Marcel Stäheli's topic in API & Templates
I tested and cannot reproduce. For published pages, editing and saving a page updates the modified timestamp but not the published timestamp. But for news pages I think it is more typical to add a datetime field to the template to serve as the posting date, so the user can change the date to suit. For instance, to set a future posting date and then in your news selector you exclude pages with posting date greater than today. -
@tpr, there is an issue with the "edit field" helper link shown in Page Edit for fieldsets. Instead of linking to the the settings of the fieldset itself it links to the settings of the first child field of the fieldset.
-
Assigning Fields to Repeaters with the API
Robin S replied to thetuningspoon's topic in API & Templates
Probably a question best answered by Ryan in the pro support board, but this worked for me... // Name of repeater matrix field $matrix_field_name = 'test_matrix'; // Name of matrix type you want to add field to $matrix_type_name = 'type_1'; // Name of field you want to add to matrix type $add_field_name = 'images'; // Get field objects $matrix_field = $fields->get($matrix_field_name); $add_field = $fields->get($add_field_name); // Add field to repeater matrix fieldgroup $matrix_template = $templates->get("repeater_$matrix_field_name"); $matrix_fieldgroup = $matrix_template->fieldgroup; $matrix_fieldgroup->add($add_field); $matrix_fieldgroup->save(); // Associate field with matrix type $matrix_types = $matrix_field->type->getMatrixTypes($matrix_field); $matrix_type_integer = $matrix_types[$matrix_type_name]; $property = "matrix{$matrix_type_integer}_fields"; $field_ids_in_type = $matrix_field->$property; $field_ids_in_type[] = $add_field->id; $matrix_field->$property = $field_ids_in_type; $matrix_field->save(); -
See the "https" property of the Template class: https://processwire.com/api/ref/template/ $t = $templates->get("name=admin"); $t->https = 0; $t->save();