Jump to content

Robin S

Members
  • Content Count

    3,798
  • Joined

  • Last visited

  • Days Won

    225

Everything posted by Robin S

  1. Sorry, I should have read the thread more carefully. In my world if a live site broke like this it would be a pretty big deal and the imperative would be to get it functioning again as quickly as possible. But it sounds like there's no pressure in this case.
  2. To give another perspective on this topic... This is something that is much easier fixed by changing host than changing the website itself. A statement like that is a clear message that it's time to find a different host. I think it's outrageous for a host to change the PHP version on a live site without warning and then tell their customers that it's their problem to solve. If a host did that to me I would drop them just on principle. Almost all shared cPanel hosting lets you pick the PHP version. So my suggestion would be to open a new account at a shared cPanel host of your choosing. This kind of hosting is as cheap as chips. Hopefully you made a backup of the site files and database before you started changing things. Set the PHP version to 5.4, create/import the database and upload the files and chances are everything will work as it did before. The host might even do the migration for you as a sweetener for new customers. You can use a subdomain (test.vivesport.co.uk) for testing the new hosting and later change the primary domain if everything is working.
  3. Adding some code to expand on my post above. In /site/ready.php: // Forgot password: add verification code as a URL parameter $wire->addHookBefore('ProcessForgotPassword::renderEmailBody', function(HookEvent $event) { $url = $event->arguments(0); $verification_code = urlencode($event->arguments(1)); $url .= "&code=$verification_code"; $event->arguments(0, $url); }); // Forgot password: pre-fill verify field from URL parameter $wire->addHookBefore('ProcessForgotPassword::renderForm', function(HookEvent $event) { $form = $event->arguments(0); $form_name = $event->arguments(1); if($form_name !== 'step3') return; $verify_field = $form->getChildByName('verify'); if(!$verify_field) return; $code = $event->wire('input')->get('code'); if(!$code) return; $verify_field->description = 'Please type or paste in the code you received in your email if it is not already shown below.'; $verify_field->value = urldecode($code); }); I just set this up on a site and it seems to be working well.
  4. A sanitizer is a good idea, but not $sanitizer->selectorValue() because as you say you are not supplying a selector to the method but are supplying a path (you can also supply an ID which is different again). So you'd want $sanitizer->pagePathName(). Yes, in fact you can see in the error message that PW builds a selector using "path=" when you supply a path to $pages->get(). See here: https://github.com/processwire/processwire/blob/88e04129c72c1702926543c8bef555a9f0d1043f/wire/core/PagesLoader.php#L131-L133 else if($selector[0] === '/') { // if selector begins with a slash, it is referring to a path $selector = "path=$selector";
  5. Robin S

    Hanna Code

    @MarkE, if you prefer to edit your Hanna code in your IDE you might find this useful:
  6. You can also use $sanitizer->entitiesMarkdown(), either for basic markdown or full markdown by setting the options argument to true.
  7. I've added support for an "integer" inputfield type in v0.3.3. Technically it was already supported via a HannaCodeDialog::buildForm hook which is the approach I would generally recommend to power users. Once you start going beyond the basics I think it's easier and more powerful to build your dialog forms via that hook.
  8. There is a difference between selectors used with PageFinder... $pages->find($selector), $page->children($selector), etc ...and selectors used in memory... $some_pagearray->find($selector) Any string that strtotime() understands can be used with a PageFinder selector, but with an in-memory selector you can only use timestamps. This is because when FieldtypeDatetime prepares the database query it actually passes the value through strtotime() if it isn't recognised as being an integer (timestamp) or a DateTime object. See here and here. But FieldtypeDatetime isn't involved with in-memory selectors so in such cases if you are working with a time string you'll need to convert it to a timestamp yourself.
  9. Here is the GitHub issue relating to the expanded file and image field properties feature: https://github.com/processwire/processwire-issues/issues/1171 This may or may not be related to what you experienced.
  10. @Peter Knight, I have experienced what I think is the same issue and discovered the same quick fix as you did. I think it's caused by errors relating to the expanded file and image field properties feature and I'm trying to narrow down the exact cause so I can open a GitHub issue. To check if what you're experiencing is the same as my issue... 1. Are you running one of the latest dev versions - 3.0.154 or 3.0.155? 2. Did you create everything from scratch inside the PW version you are running now, or did you update a site that was running an older PW version, or perhaps install using a site profile that was created under an older PW version? 3. Have you seen any error messages relating to image fields when you create a new page? E.g. something about a column not found such as modified_users_id 4. Do you have the PagePaths core module installed?
  11. When using the selector string option to define selectable pages, "page" is a special keyword that is dynamically replaced with the edited page. This only applies to the selector string option - if you are using the custom PHP code option you need to get the edited page in a different way. See the note at the bottom of your screenshot. If you want to get Repeater pages in a selector by template you'll need to include "check_access=0" because the pages themselves are not directly accessible to non-superusers. But I actually think it's better in your case to get the Repeater pages the "normal" way, which is via the Repeater fields they belong to. So you would use the custom PHP code option to define the selectable pages, and the code would be something like this: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'dependencies') { // Get the page being edited $page = $event->arguments('page'); // Create a new PageArray to hold the selectable pages $selectable = new PageArray(); // Get all the visible section pages under $page where configurable_field is not empty $sections = $page->find("template=section, configurable_field.count>0"); foreach($sections as $section) { // Add the Repeater pages for each section to $selectable $selectable->add($section->configurable_field); } // Return the PageArray $event->return = $selectable; } });
  12. Assuming the "city" Page Reference field is in the "country" or "state" template, the selector string for selectable pages would be: template=city, has_parent=page.rootParent "page" in this context means the page that is being edited.
  13. Thanks for reporting and testing - v0.3.2 has a fix for when CKEditor fields have settings overrides per Repeater Matrix type.
  14. Welcome to the forums @Pip! Technically you might be able to use hooks and custom CSS to modify a core Page Reference inputfield such as AsmSelect to include a thumbnail image but it would be quite advanced/challenging. Instead I suggest you use a third-party inputfield that supports images - see @Macrura's InputfieldSelectize: https://modules.processwire.com/modules/inputfield-selectize/
  15. You'll need to use a HannaCodeDialog::buildForm hook for that - there are way too many potential form and inputfield options to support with dedicated syntax in this module. See this section of the readme for an example hook: https://github.com/Toutouwai/HannaCodeDialog#build-entire-dialog-form-in-a-hook The PageListSelect property you want to set is parent_id. Sing out if you get stuck.
  16. You asked about this once before... 🙂 But "pages.id==1234" is a pretty naff syntax, so here's a hook that lets you match pages just by typing an ID into the admin search: $wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) { $selector = $event->return; $q = $event->wire('input')->get('q'); // If the admin search query is a number if(is_numeric($q)) { // Get the individual pieces of the selector $selector_pieces = explode(', ', $selector); // Modify the first piece so that it includes an ID clause in an OR-group $selector_pieces[0] = "({$selector_pieces[0]}), (id=$q)"; // Replace the original selector $event->return = implode(', ', $selector_pieces); } });
  17. Third option creates a static file so it can be cached by the browser, but the first option could also create a static file if you are using ProCache. Probably not much impact no matter which option you use.
  18. I haven't used it, but maybe this section of the documentation is relevant: https://docs.mapbox.com/studio-manual/reference/styles/#typography
  19. For a gallery of images you wouldn't want to insert the images separately into the CKEditor field. You'd want to loop over all the images in the field and output markup for each of them. A typical approach would be to show thumbnail images linked to larger images that display in a JS lightbox (I like to use Fresco), so your template code might look like this (assumes your images field is named "images"): <?php if($page->images->count): ?> <div class="gallery"> <?php foreach($page->images as $image): ?> <a href="<?= $image->maxSize(1000,1000)->url ?>" class="fresco" data-fresco-caption="<?= $image->description ?>"> <img src="<?= $image->size(300,300)->url ?>" alt="<?= $image->description ?>"> </a> <?php endforeach; ?> </div> <?php endif; ?> So the simplest scenario is if your blog text and gallery are separate from each other - e.g. the gallery appears before or after the text. This way you just output the gallery and text separately in your template file. Chances are that's what you want to do, but here are a couple of other scenarios and possible solutions... 1. You want to optionally insert one gallery somewhere within the blog text. In other words, you want some text, followed by the gallery, followed by some more text. One way to do this would be to have two CKEditor fields in your template, labelled "Before gallery" and "After gallery". You divide your text between these two fields. The two CKEditor fields and the images field are all output directly by code in your template file. Another way is to have a single CKEditor field use the Hanna Code module to insert the gallery somewhere in the text. You would create a PHP Hanna tag named "gallery" and use the gallery code shown above for the tag. Then you'd insert [[gallery]] in your CKEditor field wherever you want the gallery to appear. 2. You want to insert multiple galleries somewhere within the blog text. If you stump up some $$ to buy the excellent ProFields module you could use the included Repeater Matrix module to create separate matrix types for Text and Gallery. Then you just add alternating Text and Gallery items to the page as needed to build up the blog post content. Another approach for this that is a bit more advanced but that doesn't cost anything is to use a standard Repeater field for the galleries. You would add an Images field and the Title field to the Repeater field and create a Repeater item for each gallery on the page. Then you'd use Hanna Code to insert the galleries within a single CKEditor field. And to make it easier to select a gallery in the Hanna tag you can use the Hanna Code Dialog module. The "gallery" Hanna tag would have a "title" attribute and the code would look like this: <?php $repeater_item = $page->galleries->findOne("title=$title"); ?> <?php if($repeater_item->id): ?> <div class="gallery"> <?php foreach($repeater_item->images as $image): ?> <a href="<?= $image->maxSize(1000,1000)->url ?>" class="fresco" data-fresco-caption="<?= $image->description ?>"> <img src="<?= $image->size(300,300)->url ?>" alt="<?= $image->description ?>"> </a> <?php endforeach; ?> </div> <?php endif; ?> And the Hanna Code Dialog hook in /site/ready.php to build the dialog form would look like this: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // The page open in Page Edit /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'gallery') { $modules = $event->wire('modules'); $gallery_titles = $edited_page->galleries->explode('title'); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'title'; $f->id = 'title'; $f->label = 'Gallery title'; $f->addOptions($gallery_titles, false); $form->add($f); } }); And this would give you an interface in Page Edit that looks like this (when the Hanna Code dialog is open):
  20. @psy, in theory you don't need any sort of special module to put runtime markup into a field. Instead just add a Markup field to the form and then hook before the form is rendered to put whatever markup you want into it. Having said that, there are some oddities with Markup fields in FormBuilder. I raised some questions that Ryan answered here: But I still had some other problems (I can't remember exactly what they were now) that I ended up resolving by making a clone of the core InputfieldMarkup module with some minor changes. I've attached the resulting InputfieldCustomMarkup module. If you install this module and enable it for use in FormBuilder then you can use it the same as a Markup field but without the snags. InputfieldCustomMarkup.zip
  21. Thanks, I should have tested that. Fixed now in v0.1.1 Good idea, I've added this in v0.1.1
  22. A new module that should suit your needs:
  23. Displays image tags overlaid on the thumbnail using customisable colours. This makes it easier to see which images have which tags without needing to open the edit pane for individual images or changing to the list view. Screenshot Usage Enable tags for one or more image fields. Install the Image Thumbnail Tags module. Optionally configure colours for any of your tags. https://github.com/Toutouwai/ImageThumbnailTags https://modules.processwire.com/modules/image-thumbnail-tags/
  24. I'm using the very latest v5d dev version, shared by Ryan here: https://processwire.com/talk/topic/21581-repeater-matrix-v5/?do=findComment&comment=199110 But Ryan addressed that version to you so maybe you are already using it? If you're not try updating to it because this topic makes me think there might have been a problem with CKEditor fields and Repeater Matrix: https://processwire.com/talk/topic/22029-ckeditor-field-context-per-matrix-type/
  25. @schwarzdesign, I can't reproduce that issue - the toolbar dropdown appears inside Repeater Matrix fields and nested Repeater Matrix fields. Double-check that you have included "HannaDropdown" in the toolbar settings for the CKEditor field.
×
×
  • Create New...