Stephen Burge's Blog, page 17
May 7, 2019
Define Role Based Field Permissions in Drupal 8
The Field Permissions module in Drupal 8 allows you to set permissions (enter, edit or view) on a Drupal field, based on the role the user belongs to.
In order to demonstrate how this module works, we are going to create a content type called "Essay" for the website of a school.
There will be 2 roles:
Freshman
Sophomore.
The Freshmen permission will not be allowed to choose the subject of the essay, whereas the Sophomores will have the possibility to choose between literature and history. However, there will be no possibility to change the subject once a student has made a choice.
Let’s start!
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
In order to demonstrate how this module works, we are going to create a content type called "Essay" for the website of a school.
There will be 2 roles:
Freshman
Sophomore.
The Freshmen permission will not be allowed to choose the subject of the essay, whereas the Sophomores will have the possibility to choose between literature and history. However, there will be no possibility to change the subject once a student has made a choice.
Let’s start!
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on May 07, 2019 10:12
May 6, 2019
CSS Flexbox #7. The order Property
If you want to place flex-items in a particular sequence inside their flex-container, independently of how they are placed in the HTML code, you use the CSS Flexbox order property.
As you already learned in the first tutorial of this series, you can invert the order of the flex-items using row-reverse on the inline axis. This is useful when using right-to-left languages like Urdu or Hebrew.
It is also possible to invert the order of flex-items on the block axis using flex-direction: column-reverse.
The order property gives you much more flexibility because it allows you to visually change the order of each item and still keep the source order in the markup (HTML code). This is very useful for people, who use screen readers (accessibility is important).
Let’s take a look at an example.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
As you already learned in the first tutorial of this series, you can invert the order of the flex-items using row-reverse on the inline axis. This is useful when using right-to-left languages like Urdu or Hebrew.
It is also possible to invert the order of flex-items on the block axis using flex-direction: column-reverse.
The order property gives you much more flexibility because it allows you to visually change the order of each item and still keep the source order in the markup (HTML code). This is very useful for people, who use screen readers (accessibility is important).
Let’s take a look at an example.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on May 06, 2019 22:07
May 2, 2019
Weglot Review: Translate Your WordPress Site
There are a lot of ways to translate your WordPress site.
You can use an automatic translation widget such as Google Translate. You can use a fully-featured plugin such as WPML. You can use a professional translation service such as Acclaro.
However, I don’t think I’ve ever seen a translation service as slick as Weglot.
Weglot is a WordPress plugin that connects to a SaaS service. It will translate your site automatically and then allow you to fix any mistakes in the text.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
You can use an automatic translation widget such as Google Translate. You can use a fully-featured plugin such as WPML. You can use a professional translation service such as Acclaro.
However, I don’t think I’ve ever seen a translation service as slick as Weglot.
Weglot is a WordPress plugin that connects to a SaaS service. It will translate your site automatically and then allow you to fix any mistakes in the text.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on May 02, 2019 06:31
May 1, 2019
CSS Flexbox #6. The flex-basis Property
The flex-basis property sets the initial length of the flex-items inside a flex-container.
You can think of it as an improved version of the width or height values. That is, flex-basis has always prevalence over width or height.
This tutorial will demonstrate this concept with an example. Let’s start!
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
You can think of it as an improved version of the width or height values. That is, flex-basis has always prevalence over width or height.
This tutorial will demonstrate this concept with an example. Let’s start!
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on May 01, 2019 05:18
April 29, 2019
Announcing the Javascript Explained Book by Zac Gordon
If you use WordPress in a professional way, you've probably come across Zac Gordon.
Zac is an enthusiastic and charming teacher who focuses on Javascript in WordPress. He borrowed the phrase "Learn Javascript Deeply" from Matt Mullenweg and he made it into his personal slogan. For the last several years, Zac has produced video classes, online conferences, live talks, and podcasts that focus on teaching you how to use Javascript in WordPress.
We recently partnered with Zac on a book, "React Explained". That book is available now. It's a fun and enjoyable introduction to React, which is the Javascript framework of choice for WordPress, Drupal, Magento, and thousands of developers.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
Zac is an enthusiastic and charming teacher who focuses on Javascript in WordPress. He borrowed the phrase "Learn Javascript Deeply" from Matt Mullenweg and he made it into his personal slogan. For the last several years, Zac has produced video classes, online conferences, live talks, and podcasts that focus on teaching you how to use Javascript in WordPress.
We recently partnered with Zac on a book, "React Explained". That book is available now. It's a fun and enjoyable introduction to React, which is the Javascript framework of choice for WordPress, Drupal, Magento, and thousands of developers.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 29, 2019 11:50
April 25, 2019
The OSTraining Podcast #39: April Sides on Lullabot and Georgia.gov
In this week's episode, I'm delighted to welcome April Sides.
April is a Drupal developer who works for Lullabot, one of the biggest and most reputable Drupal agencies. She's worked on all sorts of fascinating projects, and at the moment she's helping Georgia.gov (the state of Georgia), move many of their Drupal sites over to Drupal 8.
We talk about what she's been doing in the Drupal world, about DrupalCon Seattle, which happened the previous week. And, what it's like to be part of such a massive government project, helping people out, by making government websites easier to use and easier to search.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
April is a Drupal developer who works for Lullabot, one of the biggest and most reputable Drupal agencies. She's worked on all sorts of fascinating projects, and at the moment she's helping Georgia.gov (the state of Georgia), move many of their Drupal sites over to Drupal 8.
We talk about what she's been doing in the Drupal world, about DrupalCon Seattle, which happened the previous week. And, what it's like to be part of such a massive government project, helping people out, by making government websites easier to use and easier to search.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 25, 2019 13:47
April 24, 2019
How to Embed Twitch Videos in WordPress Gutenberg
Twitch is a very popular video-streaming service, with around millions of broadcasters and 100s of million of viewers each month.
Twitch is known for live streams of video games, but it has branched out into other topics too. Look around Twitch and you’ll also find music videos and people live-streaming their lives.
With the EmbedPress plugin, you can add Twitch.tv both streams and chats to WordPress, using just an URL.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
Twitch is known for live streams of video games, but it has branched out into other topics too. Look around Twitch and you’ll also find music videos and people live-streaming their lives.
With the EmbedPress plugin, you can add Twitch.tv both streams and chats to WordPress, using just an URL.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 24, 2019 08:49
How to Embed Wistia Videos in Gutenberg WordPress
Wistia is a very cool video marketing service. It has a lot of features designed to make it easy to use videos in your marketing.
With the EmbedPress plugin, you can add Wistia video embeds to WordPress, using just a URL.
Wistia embeds are possible in WordPress, but they’re not easy to use via normal methods. With EmbedPress, you don’t have to mess around with embed code. All you need is the Wistia video URL.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
With the EmbedPress plugin, you can add Wistia video embeds to WordPress, using just a URL.
Wistia embeds are possible in WordPress, but they’re not easy to use via normal methods. With EmbedPress, you don’t have to mess around with embed code. All you need is the Wistia video URL.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 24, 2019 08:15
April 19, 2019
How to Use the Group Block in Gutenberg WordPress
Over the last few weeks, I've been using (and enjoying) Gutenberg more and more.
I've learned to work around it's eccentricities and in many way it's made my blogging faster and easier. The Reusable blocks feature has been particularly useful. I'm able to create an image with a caption, or a list of useful links, and quickly drop it into any post.
A new version of Gutenberg is about the make the Reusable blocks even better. Gutenberg 5.5 introduces a new "Group" block:
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
I've learned to work around it's eccentricities and in many way it's made my blogging faster and easier. The Reusable blocks feature has been particularly useful. I'm able to create an image with a caption, or a list of useful links, and quickly drop it into any post.
A new version of Gutenberg is about the make the Reusable blocks even better. Gutenberg 5.5 introduces a new "Group" block:
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 19, 2019 14:02
April 16, 2019
How to Add Drupal Webforms to Content Types
An OSTraining member asked us if it was possible to connect Webforms to their content.
I can imagine a lot of use-cases for this. For example, if you have an "Events" content type, you might want a form so visitors can contact the event organizer. Or if you have a "Business" content type, it might be useful for people to contact the business.
This can be done thanks to a module called "Webform Extra Field" and in this tutorial I'll show you how.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]
I can imagine a lot of use-cases for this. For example, if you have an "Events" content type, you might want a form so visitors can contact the event organizer. Or if you have a "Business" content type, it might be useful for people to contact the business.
This can be done thanks to a module called "Webform Extra Field" and in this tutorial I'll show you how.
[[ This is a content summary only. Visit http://OSTraining.com for full links, other content, and more! ]]

Published on April 16, 2019 08:40