Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/07/2020 in all areas

  1. 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):
    8 points
  2. I've only recently stumbled across Processwire. Thanks to ADHD and avoiding doing other work. I'm blown away at the power of Processwire. Ryan and all those who've built modules have done an incredible job of making a system that is fully customizable with incredible dev speed. Wordpress has so much bloat, it isn't very user friendly when all you want to do is quick a blog post or change. In fact unless you're a geek, It's actually quite daunting. Hell I'm still daunted by it all the time. I've never got my head around the interface layout and placement of menus and settings. On top of that, most plugins are trying to cater for anyone everyone and they have more junk to 'impress' than anything else. I love that I can just build my own functionality with PW easily or find a way to do it. What I'm particularly excited about is the end clients point of view. I could show a client in 5 minutes what they need to do to maintain their site. Changing look and theme as looks and trends move on would also be a cinch because no mark-up data is stored within the fields, unlike all the WP editor themes out there. Change templates, new site and look. All legacy data looks as good. So thank you to Ryan and the community for Processwire. I've only recently restarted developing after 15 years and frankly really didn't want to but PW has excited about web development again. I'm not one for blowing air up peoples arses but when something excites me, it excites me. ? Now I have to decide on whether I'm going to import my existing website's data or start an entirely new one ? G
    5 points
  3. Welcome to the forum @Greg Lumley! Another great aspect of Processwire vs any other is this forum itself. You have access to many great developers that have been using PW for many years and their depth of knowledge will benefit you with whatever you want to create. So jump right in with any questions!
    4 points
  4. 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); } });
    3 points
  5. This little module is for verifying a vat number (UID) through a SOAP webservice (http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl). After installing this module you get a additional option in details-tab to check the field, if it is a real UID. https://modules.processwire.com/modules/inputfield-uid/ https://github.com/hintraeger/PW-InputfieldUID
    2 points
  6. I would say go with another solution for now. I respect Kongondo for not rushing this out to market, it makes me more more excited to see it. Software development should never have timescales unless you are dealing with a client, which I know you are, but lets not rush good work. I am guessing this shouldn't even really be called Padloper anymore, so I wouldn't expect a free of charge upgrade, and in fact I hope there is no license fee reduction just because you have the previous version. I would like to reward Kongondo for his work as I do Ryan by purchasing his Pro modules, even if I don't use them.
    2 points
  7. I have had this module sitting in a 95% complete state for a while now and have finally made the push to get it out there. Thanks to @teppo for his Hanna Code Helper module which I referred to and borrowed from during development. http://modules.processwire.com/modules/hanna-code-dialog/ https://github.com/Toutouwai/HannaCodeDialog HannaCodeDialog Provides a number of enhancements for working with Hanna Code tags in CKEditor. The main enhancement is that Hanna tags in a CKEditor field may be double-clicked to edit their attributes using core ProcessWire inputfields in a modal dialog. Requires the Hanna Code module and >= ProcessWire v3.0.0. Installation Install the HannaCodeDialog module using any of the normal methods. For any CKEditor field where you want the "Insert Hanna tag" dropdown menu to appear in the CKEditor toolbar, visit the field settings and add "HannaDropdown" to the "CKEditor Toolbar" settings field. Module configuration Visit the module configuration screen to set any of the following: Exclude prefix: Hanna tags named with this prefix will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Exclude Hanna tags: Hanna tags selected here will not appear in the CKEditor toolbar dropdown menu for Hanna tag insertion. Background colour of tag widgets: you can customise the background colour used for Hanna tags in CKEditor if you like. Dialog width: in pixels Dialog height: in pixels Features Insert tag from toolbar dropdown menu Place the cursor in the CKEditor window where you want to insert your Hanna tag, then select the tag from the "Insert Hanna tag" dropdown. Advanced: if you want to control which tags appear in the dropdown on particular pages or templates you can hook HannaCodeDialog::getDropdownTags. See the forum support thread for examples . Edit tag attributes in modal dialog Insert a tag using the dropdown or double-click an existing tag in the CKEditor window to edit the tag attributes in a modal dialog. Tags are widgets Hanna tags that have been inserted in a CKEditor window are "widgets" - they have a background colour for easy identification, are protected from accidental editing, and can be moved within the text by drag-and-drop. Options for tag attributes may be defined You can define options for a tag attribute so that editors must choose an option rather than type text. This is useful for when only certain strings are valid for an attribute and also has the benefit of avoiding typos. Add a new attribute for the Hanna tag, named the same as the existing attribute you want to add options for, followed by "__options". The options themselves are defined as a string, using a pipe character as a delimiter between options. Example for an existing attribute named "vegetables": vegetables__options=Spinach|Pumpkin|Celery|Tomato|Brussels Sprout|Potato You can define a default for an attribute as normal. Use a pipe delimiter if defining multiple options as the default, for example: vegetables=Tomato|Potato Dynamic options Besides defining static options as above, you can use one Hanna tag to dynamically generate options for another. For instance, you could create a Hanna tag that generates options based on images that have been uploaded to the page, or the titles of children of the page. Your Hanna tag that generates the options should echo a string of options delimited by pipe characters (i.e. the same format as a static options string). You will probably want to name the Hanna tag that generates the options so that it starts with an underscore (or whatever prefix you have configured as the "exclude" prefix in the module config), to avoid it appearing as an insertable tag in the HannaCodeDialog dropdown menu. Example for an existing attribute named "image": image__options=[[_images_on_page]] And the code for the _images_on_page tag: <?php $image_names = array(); $image_fields = $page->fields->find('type=FieldtypeImage')->explode('name'); foreach($image_fields as $image_field) { $image_names = array_unique( array_merge($image_names, $page->$image_field->explode('name') ) ); } echo implode('|', $image_names); Choice of inputfield for attribute You can choose the inputfield that is used for an attribute in the dialog. For text attributes the supported inputfields are text (this is the default inputfield for text attributes so it isn't necessary to specify it if you want it) and textarea. Note: any manual line breaks inside a textarea are removed because these will break the CKEditor tag widget. Inputfields that support the selection of a single option are select (this is the default inputfield for attributes with options so it isn't necessary to specify it if you want it) and radios. Inputfields that support the selection of multiple options are selectmultiple, asmselect and checkboxes. You can also specify a checkbox inputfield - this is not for attributes with defined options but will limit an attribute to an integer value of 1 or 0. The names of the inputfield types are case-insensitive. Example for an existing attribute named "vegetables": vegetables__type=asmselect Descriptions and notes for inputfields You can add a description or notes to an attribute and these will be displayed in the dialog. Example for an existing attribute named "vegetables": vegetables__description=Please select vegetables for your soup. vegetables__notes=Pumpkin and celery is a delicious combination. Notes When creating or editing a Hanna tag you can view a basic cheatsheet outlining the HannaCodeDialog features relating to attributes below the "Attributes" config inputfield. Advanced Define or manipulate options in a hook You can hook HannaCodeDialog::prepareOptions to define or manipulate options for a Hanna tag attribute. Your Hanna tag must include a someattribute__options attribute in order for the hook to fire. The prepareOptions method receives the following arguments that can be used in your hook: options_string Any existing string of options you have set for the attribute attribute_name The name of the attribute the options are for tag_name The name of the Hanna tag page The page being edited If you hook after HannaCodeDialog::prepareOptions then your hook should set $event->return to an array of option values, or an associative array in the form of $value => $label. Build entire dialog form in a hook You can hook after HannaCodeDialog::buildForm to add inputfields to the dialog form. You can define options for the inputfields when you add them. Using a hook like this can be useful if you prefer to configure inputfield type/options/descriptions/notes in your IDE rather than as extra attributes in the Hanna tag settings. It's also useful if you want to use inputfield settings such as showIf. When you add the inputfields you must set both the name and the id of the inputfield to match the attribute name. You only need to set an inputfield value in the hook if you want to force the value - otherwise the current values from the tag are automatically applied. To use this hook you only have to define the essential attributes (the "fields" for the tag) in the Hanna Code settings and then all the other inputfield settings can be set in the hook. Example buildForm() hook The Hanna Code attributes defined for tag "meal" (a default value is defined for "vegetables"): vegetables=Carrot meat cooking_style comments The hook code in /site/ready.php: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // Other arguments if you need them /* @var Page $edited_page */ $edited_page = $event->arguments(1); // The page open in Page Edit $current_attributes = $event->arguments(2); // The current attribute values $default_attributes = $event->arguments(3); // The default attribute values // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'meal') { $modules = $event->wire('modules'); /* @var InputfieldCheckboxes $f */ $f = $modules->InputfieldCheckboxes; $f->name = 'vegetables'; // Set name to match attribute $f->id = 'vegetables'; // Set id to match attribute $f->label = 'Vegetables'; $f->description = 'Please select some vegetables.'; $f->notes = "If you don't eat your vegetables you can't have any pudding."; $f->addOptions(['Carrot', 'Cabbage', 'Celery'], false); $form->add($f); /* @var InputfieldRadios $f */ $f = $modules->InputfieldRadios; $f->name = 'meat'; $f->id = 'meat'; $f->label = 'Meat'; $f->addOptions(['Pork', 'Beef', 'Chicken', 'Lamb'], false); $form->add($f); /* @var InputfieldSelect $f */ $f = $modules->InputfieldSelect; $f->name = 'cooking_style'; $f->id = 'cooking_style'; $f->label = 'How would you like it cooked?'; $f->addOptions(['Fried', 'Boiled', 'Baked'], false); $form->add($f); /* @var InputfieldText $f */ $f = $modules->InputfieldText; $f->name = 'comments'; $f->id = 'comments'; $f->label = 'Comments for the chef'; $f->showIf = 'cooking_style=Fried'; $form->add($f); } }); Troubleshooting HannaCodeDialog includes and automatically loads the third-party CKEditor plugins Line Utilities and Widget. If you have added these plugins to your CKEditor field already for some purpose and experience problems with HannaCodeDialog try deactivating those plugins from the CKEditor field settings.
    1 point
  8. Since I was stuck to my flat today I took up a wish and rolled a Process module / CKEditor plugin combo that adds @-autocomplete like the mentions here in the forum to CKEditor fields. It's configurable, but only in module settings for now, the positioning of the select list is quite off and there's still some visual work to be done, so it is in early alpha state. Nonetheless, if you want to take a look, here it is: https://github.com/BitPoet/ProcessMention After installation, you may want to look into the "Additional selector" entry in the module's settings. You will most likely want to limit results to certain templates there. Edit: Updated to version 0.0.30 with fixed positioning of the dropdown. Edit2: Settings are configurable in field context now. If pwmentions is enabled, the according settings are shown on the "Input" tab.
    1 point
  9. Here's what I did: $wire->addHookAfter('HannaCodeDialog::buildForm', function(HookEvent $event) { // The Hanna tag that is being opened in the dialog $tag_name = $event->arguments(0); // The form rendered in the dialog /* @var InputfieldForm $form */ $form = $event->return; if($tag_name === 'BusinessProcess') { $modules = $event->wire('modules'); // Generate page list $f = $modules->InputfieldPageListSelect; $f->set('parent_id', 6199); $f->name = 'businessProcess'; $f->id = 'businessProcess'; $f->label = 'businessProcess'; $form->add($f); } });
    1 point
  10. 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.
    1 point
  11. Thank you Robin for your incredible answer. You've virtually given me a tutorial. This thread is gold!
    1 point
  12. Thank you everyone! All this info is awesome! This feels like the old days. Anyone remember 4guysFromRolla? 1999 ish... I learned so much from that forum, long before the days of Youtube, Apache and PHP were a nightmare to setup and CGI was king.
    1 point
  13. Single person you said? .. humm.. Haven't you realized yet that Processwire itself is a one-person project ?! There are risks everywhere, many times (too many, I would say) a large software company, which you trust, is bought by a bigger one and they discontinue their products, sometimes they incorporate functionalities to other products (and you must purchase/subscribe again with higher price) or simply kill the product because they change their field of business. Other companies changes its functionalities against your own/pesonal desire and you have to conform or start to find another alternative, ex. The Wordpress change from the Text editor to the Block editor did not like many, but it remains there and that's it. We are not safe from anything, anywhere Think about it ?
    1 point
  14. Among other things, I work for an advertising agency that focuses on a specific industry. In 1st line the orders are mostly for smaller websites (max. 20 subpages) for handicraft companies. For this purpose we are currently developing a "Master-Template", which then only needs to be filled by content editors. This template is used for all end customers and will be further developed during operation. Should an end customer have "special" wishes regarding design or function, we usually implement this in the project of the respective customer, and then adapt this functionality into the already existing "main template". For version management, we used GitHub - with the files in the /site/ folder, it works best. However, we're still looking for a way to document changes to templates and fields so we can incorporate them into the main project.
    1 point
  15. @HerTha Thanks … indeed. I did not notice that… Now I have to sum this up (for idiots like me): To redirect from index.php with an id attribute: /index.php?id=123 -> /impressum/ /index.php?id=agb -> /agb/ Put this in your PW root .htaccess, before #14 RewriteCond %{REQUEST_URI} ^\/index\.php [NC] # use this if you have digits and/or strings RewriteCond %{QUERY_STRING} ^id=(.+) [NC] # use this i you have only digits [0-9] # RewriteCond %{QUERY_STRING} ^id=(\d+) [NC] RewriteRule ^ /index_php/%1? [R,L] As @Mike Rockett pointed out, the jumplink has to be: source:index_php/{all} destination:{all|mymap} // or if you have only digits: source:index_php/{id} destination:{id|mymap} … and the mapping with the name "mymap": 123=impressum agb=agb Thats all.
    1 point
  16. Yup, it must be this one: https://processwire.com/blog/posts/pw-3.0.99/
    1 point
  17. In the Processwire world Padloper will be the right option (for safety you'll have access to the source code), @kongondo is working hard, and he is building a great piece of software, reproducing almost all Shopify functionality, but if you are in a hurry you can use the ones we have shown here, simply chose the one that best suits your needs.
    1 point
  18. Same feeling I had when I found PW around Christmas-time a year and a half ago. It still feels like wrapping up Christmas gifts, every time I find a new useful module (though the modules directory is a bit messy ?).
    1 point
  19. These two maybe?
    1 point
  20. Great ? You can tell what kind of tiles you're using by the API endpoint your tileLayer is calling. My code above uses /tiles/ after the style which is the endpoint for raster tiles. Or check the network tab in the Devtools, if your tile requests are returning PNGs you're using raster tiles, for vector tiles it would probably be JSON. You're not supposed to scroll out ? No idea honestly, IIRC we adapted one of the default styles slightly, might've been an oversight. Doesn't really matter since the map just focusses around Cologne, so normally you won't see the country names ?
    1 point
  21. Ok, I should have used that. ? Very nice! It's also monochrome gray. You have left the country name labels in english, all other labels seems to be in german. What was/is the reason for this?
    1 point
  22. Hi Moritz, many thanks. I had no explicit settings for tileSize and zoomOffset in my script. I only had maxZoom, id and accessToken. Also I don't no if I get vector or raster tiles ATM. But simply adding your suggested settings already worked for me. Yeah! ? Now I know that it is possible (for me) to go this way with a customized map and can go more in depth to explore how to setup it all well. (Yesterday I struggled on this and wasted some hours.)
    1 point
  23. We are using Mapbox and a Studio style with Leaflet for the Architekturführer Köln Map. Are you using raster or vector tiles? We're using raster tiles, in this case it may be caused by the zoomOffset and tileSize in your tileLayer. For reference, here's our tileLayer definition: const tileLayer = L.tileLayer( "https://api.mapbox.com/styles/v1/schwarzdesign/{STYLE_ID}/tiles/256/{z}/{x}/{y}@2x?access_token={TOKEN}", { maxZoom: 18, tileSize: 256, zoomOffset: 0, attribution: '<a href="https://www.openstreetmap.org/copyright">© OpenStreetMap</a> | <a href="https://www.mapbox.com/map-feedback/#/-74.5/40/10">Improve this map</a>', } ); Previously we used tileSize: 512 and zoomOffset: -1 to cut down on the number of tile requests. This way each tile was much larger, which resulted in much larger text. In any case, you could use those settings to offset your scaling issues (though this is of course a workaround, not a fix). If you're using vector tiles I have no idea ?
    1 point
  24. If you have higher volumes of sales Snipcart offers special prices. Just contact them. They are very flexible!
    1 point
  25. Thanks @kixe and @elabx I'm gonna look in to those option!
    1 point
  26. With FieldtypeColor https://modules.processwire.com/modules/fieldtype-color/ you have multiple options for the Inputfield: Text, HTML5 Color, any Javascript ... If you are able to create a custom SQL table for your colors FieldtypeSelectExtOption https://modules.processwire.com/modules/fieldtype-select-ext-option/ is a possible solution for your needs, since you can use the hex code as the value here.
    1 point
  27. Ok, when working with image fields, you have many useful functions right with the core image field, and / or you can use third party modules. At first, you should enable the imagick rendering engine under modules > core > image. (Your webserver need to support this) Also you can enable the animated gif engine. The engines get invoked by inspected image filetypes. It do no harm to have more then the default fallback based on GD-lib. With the core image fields you can enable/disable a lot of features, like limiting the amount of images, allow upload of multiple images via ZIP, make use of focus point & zoom!, and many more. When it comes to cropping, you have many different ways to choose from. I prefer using the focus point and template code, assisted by PIA. You can use the built in crop functionality for manually create and name crop variations, but if you do, go and add the ImageCropRatios module to the toolbox. With it you can define fixed ratios. Another way can be to use the CroppableImage4 module. (module board of CAI3) With it you can define crop ratios per template basis. Also interesting, the CAI4 extends the core image field, what lets you use all functionalities in one field. You can make use of the focus & zoom in one template, and use predefined crops in another. If you once have a need for individual image manipulation, there is a module too. Thats the toolbox that I use or select from, but there are a lot more in regard of the variation filenames, EXIF data. There are modules that create a lightbox gallery out of the box, and more. But best is to know how the core pageimage work, in template scope and elsewhere! ---------------------------------------------------------------------------------- More: https://modules.processwire.com/modules/process-media-manager/
    1 point
  28. @Sevarf2 How do you manage state in your template — get variables? The template panel works best for displaying static data. For creating pages and importing data I'd suggest creating a custom panel type. That'd make it much easier to manage the required multi-step processes. Or better yet, a Process module for importing data and a separate dashboard panel that only kicks off the import and hands off the actual workload to the main module.
    1 point
  29. Shopify Basic: $29/mo + Payment Gateway: 2.9% + 30¢ each sale Shopify Standard: $79/mo + Payment Gateway: 2.6% + 30¢ each sale Shopify Advance: $299/mo + Payment Gateway: 2.4% + 30¢ each sale Snipcart: 2% each sale + Payment Gateway: 2.9% + 30¢ each sale
    1 point
  30. You could put this in your site/init.php: $this->addHookAfter("Page::viewable", function($event) { if ($event->object->isUnpublished() && wire('input')->get('preview') === 'true') { $event->return = true; } }); It won’t work in site/ready.php because the 404 will already be thrown by the time you get there. Of course, you may also make a module out of it.
    1 point
  31. The module from @kixe uses Spectrum jquery color picker and it has an option to show only a palette. https://modules.processwire.com/modules/fieldtype-color/
    1 point
  32. The only thing I know about hooks is to catch fish. ? You might take a look at @kixe's module color field to see how it was done there. Another option, if you have a limited selection is to use individual pages for each color.
    1 point
  33. I only have one kid, so in some ways that keeps things easier, although she's in the office with me on the other PC which can make things interesting at times. We are allowed out walking as long as we keep to our neighbourhood and stay a safe distance from other people. Things have been pretty relaxed up until Sunday when the oven died, which made things a bit more inconvenient as we've been doing a lot of home baking, but that is out of the question now until I can get someone to repair it, or buy a replacement, which either way looks like at least a week away. At least there's a good chance of eliminating the virus completely here within the next few weeks, which will allow life to return to some semblance of normal, but the borders will likely be closed well beyond the end of the year.
    1 point
  34. @Pete From this side, my wife's job is one that requires her to be on phone/video meetings most of the day, so she's got to lock herself away from us to focus on that, and the kids are mostly with me during the day. I'm good at focused attention, but not great at changing gears, so I'm still learning. My days used to be just coffee and code. Now things are much more diverse, here's a typical day: wakeup, breakfast, coffee, code, kids wakeup, resolve dispute, make breakfast, coffee, code, hear that TV is on, check in to make sure kids are doing school work, turn off TV, say “get back to school work”, try to figure out something with google classroom, worry about whether I'm doing enough to keep kids focused on school, code, get icloud request to approve download of some game on iPad, tell kids to “get back to work”, explain why several times, answer questions about school work, hear music from some game and decide to let it slide, 1 email, cycle power on router because wife says she can't connect to important video call, code, resolve kids dispute, put 1 kid in timeout, legos, clean up spill, 1 email, slack message, cook lunch, coffee, code, worry about whether kids are spending too much time on screens, phone call, reset wifi because daughter says Roblox won't connect, then work a little more, click the "snooze" button on a dozen emails so they return tomorrow, take kids outside to play while I work on house or yard, ride bikes, cook dinner, eat, netflix, cleanup dinner, go to bed, feel thankful to be healthy, sleep well. I'm definitely still adapting here, but I can't complain about the new normal because having everyone under one roof is comforting, especially at times like this. And while it's harder to get work done, it's mostly still getting done and I just feel thankful to be staying busy. Also, knowing there's nowhere to go but home, life is simpler in many ways.
    1 point
  35. @adrian There are two options when you initialize your CommentForm that let you define what you want to be populated, and whether or not you want it to be editable. These are the 'presets' (array) and 'presetsEditable' (bool) options. I'm initializing with the new CommentFormCustom class below, but the presets options also work with older versions of PW: $options = [ 'className' => 'CommentFormCustom' ]; if($user->isLoggedin()) { $options['presetsEditable'] = false; $options['presets'] = [ 'cite' => "$user->first_name $user->last_name", 'email' => $user->email, ]; } $form = $page->comments->getCommentForm($options); As for using a local image for avatar, or deciding whether or not to show cite and email, this is where the CommentFormCustom class comes in handy. It leaves you in full control of the markup, so you can render whatever avatar image in there you want (whether CommentFormCustom or CommentListCustom), and exclude fields in your markup when conditions dictate. In previous versions, if you didn't want to show specific fields in the form then you would hide them with CSS. @AndZyk Here's how you might do that with a hook. This looks for markdown style links, i.e. [text](url) and converts them to HTML links. The regex may need improvement still, but maybe it's a starting point. $wire->addHookBefore('CommentList::renderItem', function($event) { $comment = $event->arguments(0); /** @var Comment $comment */ $text = $comment->getFormatted('text'); $textOriginal = $text; // look for markdown style links: [text](url) if(strpos($text, '](') { $regex = '!\[(.+?)\]\((https?://[^)\s\r\n;"\']+)\)!i'; $link = '<a href="$2" rel="noopener noreferrer nofollow" target="_blank">$1</a>'; $text = preg_replace($regex, $link, $text); } // populate changed comment text if($text !== $textOriginal) { $comment->set('textFormatted', $text); } });
    1 point
  36. In my case, sessions were not handled correctly. In order to fix it: 1. I installed the core module Session Handler Database (SessionHandlerDB) locally, 2. Create a mysqldump of my local database 3. Imported the mysqldump to my online environment 4. Voila!
    1 point
×
×
  • Create New...