Craft 3.4 & Commerce 3 RCs, Dot One Tix, loads of Craft tips
Welcome to another issue of Craft Link List. Are you surprised that you’re receiving this on Jan 21? If case you missed the announcement, CLL now publishes on the 1st and 3rd Tuesday of the month instead of specific dates. No more weekend issues!
We kick off the issue with the release candidates for Craft 3.4 and Commerce 3. DotOne is also on the horizon. There are lots of great tips and plugins as well.
If you have a link to share, head over to the submit a link page. It helps with putting each issue together.
Thank you to Solspace for sponsoring this issue.
Solspace is growing and is hiring a full-time developer. Are you the one? Start the new decade with a new job!
Let’s hit the links.
Craft 3.4 Hits Release Candidate Stage
We’re getting close now. What’s new in 3.4?
- New look & feel
- Delta entry updates
- Entry change tracking
- Asset edit pages
- GraphQL improvements
- Queue Manager (a huge improvement)
- New permissions
- Lots of other quality of life improvements
As mentioned on Twitter, To update to 3.4 RC1, change your
craftcms/cms requirement in composer.json to:
Commerce 3 Reaches Release Candidate Stage
What’s new in the upcoming Commerce 3?
- Edit and create orders right in the control panel
- GraphQL support for products
- Manage customers & addresses
- Send customer emails from Edit Order pages
- Lots more
As mentioned on Twitter to update to Commerce 3 RC1, change your
craftcms/commerce requirement in composer.json to:
Dot One Australia 2020 | Craft CMS
Dot One is coming to Australia on March 4! Get your tickets to the official Craft CMS event down under.
Craft 2 and Commerce 1 End-of-Life Dates
These EOL dates for Craft 2 and Commerce 1 were mentioned back in issue 76 but it’s worth noting this again because January 31, 2020 is getting close.
Bug fixes will be supported through January 31, 2020.
Tools, tips, and fundamentals
Why would composer update find no updates to install?
John Faulds asked this question Twitter. As the Twitter thread indicates, check your package.json and see if your versions are locked to a single version of a required package. If so, you might need to add a
^ in front of the version number and try to
composer update again.
Using a subdirectory for Craft
A question came up on Discord recently about using a subdirectory to contain Craft app files. In this instance, the hosting company only allowed uploading files to the public directory, which meant the traditional home for the Craft application files, one level above the publicly facing directory, wasn't possible. Craft CMS expects its app files, as seen in this link, to be one level above the public folder.
Brandon shared the following steps for dealing with this situation.
- Rename web/ to public_html/ (i.e. the directory that is typically publicly viewable in a Craft site)
- Move all the Craft files/folders that live alongside
public_html/into a folder inside
public_html/ (i.e. public_html/craft/...)
- Assuming this is Apache, create a
.htaccessfile inside that folder
(public_html/craft/.htaccess)with this content:
Deny from all
- Change this line (https://github.com/craftcms/craft/blob/master/web/index.php#L7) in public_html/index.php to:
define('CRAFT_BASE_PATH', __DIR__ . '/craft');
Up and Running with Craft 3 - updated for version 3.4
Ryan has updated the Up and Running with Craft 3 course for Craft 3.4. The course is free, but you need to sign up for a free account at CraftQuest.
4 Ways to Export Craft Entries as JSON
This CraftQuest lesson shows how to get Craft entries data into a different format so you can allow another application to use the data or migrate to another system. Ryan covers four different options.
This CraftQuest lesson requires a paid subscription. Editor’s note: It’s worth it!
Extending the validation on the public user registration form
This gist will show you how to require the first and last names on a public registration form in Craft.
How to block 404.twig page from direct access
Piotr has a quick tip on protecting your 404 and other error templates (like for 503 errors) from being accessed via a direct URL.
Can you filter entries in CP by author in control panel?
According to this StackExchange post, you can't do this type of filtering natively in Craft, but there is a code snippet that shows how you could make a quick custom plugin or module to add the functionality.
Quick Start: Developing a Craft 3 Plugin
Jake Dohm has a step-by-step guide for development workflow needed to create a Craft plugin: scaffolding, what to do in your package.json file, etc.
My PhpStorm settings after 8 years of use
In this post, Stefan Bauer shares “the result of my 8 years of experience with PhpStorm and my best settings that make you a faster developer and let you focus more on the important things.”
Auto-Complete Craft CMS 3 APIs in Twig with PhpStorm
This is not a new post from Andrew, but I think I missed mentioning it previously. If you use PHPStorm for your Craft development, be sure to check it out.
Change a Field’s Value Across Selected Entries Using Craft 3
If you’re not comfortable writing MySQL queries, Twig might be a more comfortable environment to do data changes. This Craft Cookbook post shows how to use “Twig to loop through whichever elements you select, change the values of a designated field, and then save those elements.”
Craft CMS Sass Mix-in for the control panel
Plugins that need to extend the Craft CMS Control Panel can use this library and import _mixins.sass from their Sass files, giving them the same mixins and variables used by core Control Panel templates.
Finding events are available to listen for
Andrew shared this 🔥 tip on Twitter: search the
cms/src directory on
Perfecting your technique
Using the Craft CMS "headless" with the GraphQL API
Craft CMS 3.3 added a GraphQL layer that gives your website a formalized, structured API out of the box. In this post, Andrew shows how to use GraphQL + Craft CMS as a “headless” CMS.
Using Craft 3 as a headless CMS with GraphQL and Vue Apollo
Johnny Mueller from Telegraph has written about using Craft CMS as a headless CMS to integrate Shopify content using a Vue front end with GraphQL and Vue Apollo. He discusses a few snags along the way and what he’d do differently next time.
CSRF Tokens in “Headless” Applications
August Miller shares a summary of a recent Discord discussion on CSRF in Craft headless applications in this Stack Exchange post.
Architecting & developing a Craft CMS 3 plugin in PHP
Jake Dohm joins August Miller and Andrew Welch in this live-stream video to talk about Craft plugin development, specifically around managing Instagram’s new API.
Building AJAX contact form with Craft CMS
Piotr discusses using AJAX for form submission in this Craft Snippets post.
Customizing Craft Commerce
Justin Holt posted several presentation decks from the Craft Meetups in Charlotte.
This deck walks through several ways to customize Craft Commerce: events, adjusters, shipping methods, and custom coupons. It also reviews a real-world example that can “perform calculations on total order dimensions to determine correct standard box size... to provide to FedEx API.”
Testing in Craft CMS
This presentation deck from the Charlotte Craft Meetup reviews testing in Craft. Including:
- How can tests help?
- Types of tests.
- How to run Codeception tests in
- Testing modules and plugins.
- Offloading tests to Queue.
Craft: Component Driven Development
This presentation deck from the Charlotte Craft Meetup covers components. Justin discusses the concept, benefits, and techniques of components in Craft.
Now Hiring: Software Plugin Developer
The Solspace team is expanding! If you’re looking for an exciting full-time position working on Freeform and Calendar plugins for Craft and more, we’d love to hear from you! Check out our job listing for more details.
Count and display the number of times that an asset has been viewed.
This plugin will pull Venues, Shows and Events from a Ticketsolve XML feed and store them for easy access in your Craft website.
Country Select Extended
Country selector originally developed by Luke Youell and now maintained by Andreas Beder.
Server Side Renderer
Generate PDFs easily and cost-effectively, using Api2Pdf.com.
This plugin provides a simple way to add an age-verification-gate to your website, where the user has to verify their age.
The Craft Advantage
Craft CMS vs WordPress
I don’t want to ruin the suspense, but you had me at “entangled mess.”
WordPress has become an entangled mess of open source code, and the amount of trash that is created with WordPress has exponentially increased over the years. Junk plugins, junk themes, junky hacked websites, junky apps that don’t work anymore because they fell out of versioning like so many do.
Yii, Twig, PHP & More
New Year, New Things
Sam Hernandez, who many of you may know from the Craft community, is leaving the Craft team. So long, Sam. Best of luck as the adventure continues. 🍀
It’s not Craft, but it’s interesting.
Developing Blocker-Friendly Websites
This smart post from Tighten is a must-read.
Implementing these techniques will improve the resiliency of your site across the board, and harden it against errors and unexpected downtime.
Microbrowsers are Everywhere
This post argues that the “microbrowser [is] probably more important than google bot” due to the importance of online word-of-mouth discussions where the preview image of a URL helps drive traffic.
rel=noopener is a preventative solution to hijacking
window.opener.location, which can be used in phishing attacks. The post contains a working, proof-of-concept example. I had no idea.
Operator Mono Lig
Operator Mono is a popular mono-space font for coding. This version of the font adds ligatures to the original version of Operator Mono. This makes it similar to Fira Code, another popular mono-space coding font, which has been mentioned in the newsletter previously.
A free and open-source typeface for developers. And, yes, it has ligatures.
How HTTP Cookies Work
Although many programming languages and frameworks will abstract the parsing and creation of... cookie headers for you, it is occasionally good to know how it all works behind the scenes.
Lightweight fuzzy-search library. Zero dependencies.
devMode.fm // Building Mobile Apps with React Native
Paulo Ellias joins the devMode crew to discuss building real native iOS and Android apps in React native and “what it’s like to go from building CMS websites to building React frontends to building React Native apps, and how it’s not as much of a leap as you might think.”
PurgeCSS 2.0 - Full Human
The popular CSS optimizer gets an update.