Development News

Gizra.com: Using JSON API with WebdriverIO Tests

Main Drupal Feed - Mon, 07/02/2018 - 04:00

In Drupal, you can write automated tests with different levels of complexity. If you need to test a single function, or method of a class, probably you will be fine with a unit test. When you need to interact with the database, you can create kernel tests. And finally, if you need access to the final HTML rendered by the browser, or play with some javascript, you can use functional tests or Javascript tests. You can read more about this in the Drupal.org documentation.

So far this is what Drupal provides out of the box. On top of that, you can use Behat or WebDriver tests. This types of tests are usually easier to write and are closer to the user needs. As a side point, they are usually slower than the previous methods.

The Problem.

In Gizra, we use WebdriverIO for most of our tests. This allow us to tests useful things that add value to our clients. But these sort of tests, where you only interact with the browser output, has some disadvantages.

Imagine you want to create an article and check that this node is unpublished by default. How do you check this? Remember you only have the browser output…

One possible way could be this: Login, visit the Article creation form, fill the fields, click submit, and then… Maybe search for some unpublished class in the html:

var assert = require('assert'); describe('create article', function() { it('should be possible to create articles, unpublished by default', function() { browser.loginAs('some user'); browser.url('http://example.com/node/add/article') browser.setValueSafe('#edit-title-0-value', 'My new article'); browser.setWysiwygValue('edit-body-0-value', 'My new article body text'); browser.click('#edit-submit'); browser.waitForVisible('.node-unpublished'); }); });

This is quite simple to understand, but it has some drawbacks.

For one, it depends on the theme to get the status of the node. You could take another approach and instead of looking for a .node-unpublished class, you could logout from the current session and then try to visit the url to look for an access denied legend.

Getting Low-Level Information from a Browser Test

So the problem boils down to this:

How can I get information about internal properties from a browser test?

The new age of decoupled Drupal brings an answer to this question. It could be a bit counterintuitive at first, therefore just try to see is fit for your project.

The idea is to use the new modules that expose Drupal internals, through json endpoints, and use javascript together with a high-level testing framework to get the info you need.

In Gizra we use WDIO tests write end-to-end tests. We have some articles about this topic. We also wrote about a new module called JsonAPI that exposes all the information you need to enrich your tests.

The previous test could be rewritten into a different test. By making use of the JsonAPI module, you can get the status of a specific node by parsing a JSON document:

var assert = require('assert'); describe('create article', function() { it('should be possible to create articles, unpublished by default', function() { browser.loginAs('some user'); browser.url('http://example.com/node/add/article') browser.setValueSafe('#edit-title-0-value', 'My unique title'); browser.setWysiwygValue('edit-body-0-value', 'My new article body text'); browser.click('#edit-submit'); // Use JSON api to get the internal data of a node. let query = '/jsonapi/node/article' += '?fields[node--article]=status' += '&filter[status]=0' += '&filter[node-title][condition][path]=title' += '&filter[node-title][condition][value]=My unique title' += '&filter[node-title][condition][operator]=CONTAINS' browser.url(query); browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false)); assert.ok(json[0].id); assert.equals(false, json[0].attributes.content['status']); }); });

In case you skipped the code, don’t worry, it’s quite simple to understand, let’s analyze it:

1. Create the node as usual:

This is the same as before:

browser.url('http://example.com/node/add/article') browser.setValueSafe('#edit-title-0-value', 'My unique title'); browser.setWysiwygValue('edit-body-0-value', 'My new article body text'); browser.click('#edit-submit'); 2. Ask JsonAPI for the status of an article with a specific title:

Here you see the two parts of the request and the parsing of the data.

let query = '/jsonapi/node/article' += '?fields[node--article]=status' += '&filter[status]=0' += '&filter[node-title][condition][path]=title' += '&filter[node-title][condition][value]=My unique title' += '&filter[node-title][condition][operator]=CONTAINS' browser.url(query); 3. Make assertions based on the data:

Since JsonAPI exposes, well, json data, you can convert the json into a javascript object and then use the dot notation to access to a specific level.

This is how you can identify a section of a json document. browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false)); assert.ok(json[0].id); assert.equals(false, json[0].attributes.content['status']); A Few Enhancements

As you can see, you can parse the output of a json request directly from the browser.

browser.url('/jsonapi/node/article'); browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false));

The json object now contains the entire response from JsonAPI that you can use as part of your test.

There are some drawbacks of the previous approach. First, this only works for Chrome. That includes the Json response inside a XML document. This is the reason why you need to get the HTML from body pre.

The other problem is this somewhat cryptic section:

let query = '/jsonapi/node/article' += '?fields[node--article]=status' += '&filter[status]=0' += '&filter[node-title][condition][path]=title' += '&filter[node-title][condition][value]=My unique title' += '&filter[node-title][condition][operator]=CONTAINS'

The first problem can be fixed using a conditional to check which type of browser are you using to run the tests.

The second problem can be addressed using the d8-jsonapi-querystring package, that allows you to write an object that is automatically converted into a query string.

Other Use Cases

So far, we used JsonAPI to get information about a node. But there are other things that you can get from this API. Since all configurations are exposed, you could check if some role have some specific permission. To make tests shorter we skipped the describe and it sections.

browser.loginAs('some user'); let query = '/jsonapi/user_role/user_role' += '?filter[is_admin]=null' browser.url(query); browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false)); json.forEach(function(role) { assert.ok(role.attributes.permissions.indexOf("bypass node access") == -1); });

Or if a field is available in some content type, but it is hidden to the end user:

browser.loginAs('some user'); let query = '/jsonapi/entity_form_display/entity_form_display?filter[bundle]=article' browser.url(query); browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false)); assert.ok(json[0].attributes.hidden.field_country);

Or if some specific HTML tag is allowed in an input format:

let query = '/jsonapi/filter_format/filter_format?filter[format]=filtered_html' browser.url(query); browser.waitForVisible('body pre'); let json = JSON.parse(browser.getHTML('body pre', false)); let tag = '<drupal-entity data-*>'; assert.ok(json[0].attributes.filters.filter_html.settings.allowed_html.indexOf(tag) > -1);

As you can see, there are several use cases. The benefits of being able to explore the API by just clicking the different links sometimes make this much easier to write than a kernel test.

Just remember that this type of tests are a bit slower to run, since they require a full Drupal instance running. But if you have some continuous integration in place, it could be an interesting approach to try. At least for some specific tests.

We have found this quite useful, for example, to check that a node can be referenced by another in a reference field. To check this, you need the node ids of all the nodes created by the tests.

A tweet by @skyredwang could be accurate to close this post.

Remember how cool Views have been since Drupal 4.6? #JSONAPI module by @e0ipso is the new "Views".

— Jingsheng Wang (@skyredwang) January 9, 2018

Continue reading…

Matt: Work and Play

Wordpress Planet - Sun, 07/01/2018 - 01:13

A master in the art of living draws no sharp distinction between his work and his play; his labor and his leisure; his mind and his body; his education and his recreation. He hardly knows which is which. He simply pursues his vision of excellence through whatever he is doing, and leaves others to determine whether he is working or playing. To himself, he always appears to be doing both.

Lawrence Pearsall Jacks in Education through Recreation, 1932

Wim Leers: Shipping the right thing

Main Drupal Feed - Sun, 07/01/2018 - 00:03

Two weeks ago, I stumbled upon a two-part blog post by Alex Russell, titled Effective Standards Work.

The first part (The Lay Of The Land) sets the stage. The second part (Threading the Needle) attempts to draw conclusions.

It’s worth reading if you’re interested in how Drupal is developed, or in how any consensus-driven open source project works (rather than the increasingly common “controlled by a single corporate entity” “open source”).

It’s written with empathy, modesty and honesty. It shows the struggle of somebody given the task and opportunity to help shape/improve the developer experience of many, but not necessarily the resources to make it happen. I’m grateful he posted it, because something like this is not easy to write nor publish — which he also says himself:

I’ve been drafting and re-drafting versions of this post for almost 4 years. In that time I’ve promised a dozen or more people that I had a post in process that talked about these issues, but for some of the reasons I cited at the beginning, it has never seemed a good time to hit “Publish”. To those folks, my apologies for the delay.

Parallels!

I hope you’ll find the incredibly many parallels with the open source Drupal ecosystem as fascinating as I did!

Below, I’ve picked out some of the most interesting statements and replaced only a few terms, and tadaaa! — it’s accurately describing observations in the Drupal world!

Go read those two blog posts first before reading my observations though! You’ll find some that I didn’t. Then come back here and see which ones I see, having been a Drupal contributor for >11 years and a paid full-time Drupal core contributor for >6.

Standards Theory

Design A new Drupal contrib module is the process of trying to address a problem with a new feature. Standardisation Moving a contributed module into Drupal core is the process of documenting consensus.

The process of feature design Drupal contrib module development is a messy, exciting exploration embarked upon from a place of trust and hope. It requires folks who have problems (web developers site builders) and the people who can solve them (browser engineers Drupal core/contrib developers) to have wide-ranging conversations.

The Forces at Play

Feature Drupal module design starts by exploring problems without knowing the answers, whereas participation in Working Groups Drupal core initiatives entails sifting a set of proposed solutions and integrating the best proposals competing Drupal modules. Late-stage iteration can happen there, but every change made without developer site builder feedback is dangerous — and Working Groups Drupal core initiatives aren’t set up to collect or prioritise it.

A sure way for a browser engineer Drupal core/contrib developer to attract kudos is to make existing content Drupal sites work better, thereby directly improving things for users site builders who choose your browser Drupal module.

Essential Ingredients
  • Participation by web developers site builders and browser engineers Drupal core/contrib developers: Nothing good happens without both groups at the table.
  • A venue outside a chartered Working Group Drupal core in which to design and iterate: Pre-determined outcomes rarely yield new insights and approaches. Long-term relationships of WG participants Drupal core developers can also be toxic to new ideas. Nobody takes their first tap-dancing lessons under Broadway’s big lights. Start small and nimble, build from there.
  • A path towards eventual standardisation stability & maintainability: Care must be taken to ensure that IP obligations API & data model stability can be met the future, even if the loose, early group isn’t concerned with a strict IP policy update path
  • Face-to-face deliberation: I’ve never witnessed early design work go well without in-person collaboration. At a minimum, it bootstraps the human relationships necessary to jointly explore alternatives.

    If you’ve never been to a functioning standards Drupal core meeting, it’s easy to imagine languid intellectual salons wherein brilliant ideas spring forth unbidden and perfect consensus is forged in a blinding flash. Nothing could be further from the real experience. Instead, the time available to cover updates and get into nuances of proposed changes can easily eat all of the scheduled time. And this is expensive time! Even when participants don’t have to travel to meet, high-profile groups Drupal core contributors are comically busy. Recall that the most in-demand members of the group Drupal core initiative (chairs Drupal core initiative coordinators, engineers from the most consequential firms Drupal agencies) are doing this as a part-time commitment. Standards work is time away from the day-job, so making the time and expense count matters.
Design → Iterate → Ship & Standardise

What I’ve learned over the past decade trying to evolving the web platform is a frustratingly short list given the amount of pain involved in extracting each insight:

  • Do early design work in small, invested groups
  • Design in the open, but away from the bright lights of the big stage
  • Iterate furiously early on because once it’s in the web Drupal core, it’s forever
  • Prioritize plausible interoperability; if an implementer says “that can’t work”, believe them!
  • Ship to a limited audience using experimental Drupal core modules as soon as possible to get feedback
  • Drive standards stabilization of experimental Drupal core modules with evidence and developer feedback from those iterations
  • Prioritise interop minimally viable APIs & evolvability over perfect specs APIs & data models; tests create compatibility stability as much or more than tight prose or perfect IDL APIs
  • Dot “i”s and cross “t”s; chartered Working Groups Drupal core initiatives and wide review many site builders trying experimental core modules are important ways to improve your design later in the game. These derive from our overriding goal: ship the right thing.

    So how can you shape the future of the platform as a web developer site builder?

The first thing to understand is that browser engineers Drupal core/contrib developers want to solve important problems, but they might not know which problems are worth their time. Making progress with implementers site builders is often a function of helping them understand the positive impact of solving a problem. They don’t feel it, so you may need to sell it!

Building this understanding is a social process. Available, objective evidence can be an important tool, but so are stories. Getting these in front of a sympathetic audience within a browser team of Drupal core committers or Drupal contrib module maintainers is perhaps harder.

It has gotten ever easier to stay engaged as designs experimental Drupal core modules iterate. After initial meetings, early designs are sketched up and frequently posted to GitHub Drupal.org issues where you can provide comments.

“Ship The Right Thing”

These relatively new opportunities for participation outside formal processes have been intentionally constructed to give developers and evidence a larger role in the design process.

There’s a meta-critique of formal standards processes in Drupal core and the defacto-exclusionary processes used to create them. This series didn’t deal in it deeply because doing so would require a long digression into the laws surrounding anti-trust and competition. Suffice to say, I have a deep personal interest in bringing more voices into developing the future of the web platform, and the changes to Chrome’s Drupal core’s approach to standards adding new modules discussed above have been made with an explicit eye towards broader diversity, inclusion, and a greater role for evidence.

I hope you enjoyed Alex’ blog posts as much as I did!

Larry Garfield: PHP: Use associative arrays basically never

Main Drupal Feed - Sat, 06/30/2018 - 20:59
PHP: Use associative arrays basically never

The other day I was working on some sample code to test out an idea that involved an object with an internal nested array. This is a pretty common pattern in PHP: You have some simple one-off internal data structure so you make an informal struct using PHP associative arrays. Maybe you document it in a docblock, or maybe you're a lazy jerk and you don't. (Fight me!) But really, who bothers with defining a class for something that simple?

But that got me wondering, is that common pattern really, you know, good? Are objects actually more expensive or harder to work with than arrays? Or, more to the point, is that true today on PHP 7 given all the optimizations that have happened over the years compared with the bad old days of PHP 4?

So like any good scientist I decided to test it: What I found will shock you!

Continue reading this post on Steemit

Larry 30 June 2018 - 4:59pm

[Online/Free]..Argentina vs France 2018 Live Stream Fifa World Cup

Drupal News Org - Sat, 06/30/2018 - 14:30

[Online/Free]..Argentina vs France 2018 Live Stream Fifa World Cup
-----------------------------------------------------
WATCH NOW:::> http://onlinetvguide.net/FIFA-2018/

FREE HERE:::> http://onlinetvguide.net/FIFA-2018/
-----------------------------------------------------
France vs Argentina LIVE World Cup 2018: Prediction how to watch
France vs Argentina LIVE World Cup 2018: Prediction how to watch online what time what channel team news betting odds  
France v Argentina Uruguay v Portugal
France v Argentina Live All you need to know about the  Live Reporting By Steve Sutcliffe All times
France vs Argentina Live Score FIFA World Cup 2018 Live Streaming

France vs Argentina Live Score FIFA World Cup 2018 Round of 16 Live Streaming: Catch Live Score and updates as France take
France vs Argentina live stream: Lineups Kickoff time TV listings how
Messi vs Umtiti and Dembélé!  France vs Argentina live stream: Lineups Kickoff time TV listings how to
Fifa World Cup 2018 France vs Argentina live score: When and Where
Fifa World Cup 2018 France vs Argentina live score: When and Where to watch on Business Standard The first match of
World Cup 2018: France v Argentina live blog teams scores lineup

France vs Argentina: Team News Live Stream TV Info for World Cup
France vs Argentina will kick off the knockout stages of the 2018 FIFA World Cup on Saturday when two of the favourites
Argentina vs France World Cup live stream info channel: 2018 World Cup's round of 16 begins on Saturday and it kicks off
Argentina vs France in Kazan with a spot in the

Post Status: An Abundance of Acquisitions — Draft Podcast

Wordpress Planet - Fri, 06/29/2018 - 22:11

Welcome to the Post Status Draft podcast, which you can find on iTunes, Google Play, Stitcher, and via RSS for your favorite podcatcher. Post Status Draft is hosted by Brian Krogsgard and co-host Brian Richards.

In this episode, the Brians have a chat about a number of different acquisitions that have occurred in the WordPress space over these past few weeks. Listen in as they unpack some of the news surrounding StudioPress, WPEngine, Automattic, WPNinjas, Prospress, and AutomateWoo. Check out our episode links for further stories about each of those businesses as well as the virtual JavaScript for WordPress conference taking place live on July 29.

Links Sponsor: Jilt

Jilt offers powerful email marketing built for eCommerce. Join thousands of stores that have already earned over $28,000,000 in extra sales using Jilt. Try Jilt for free

WPTavern: WCEU Panel Discusses Progressive WordPress Themes, AMP, and Gutenberg

Wordpress Planet - Fri, 06/29/2018 - 22:03

Progressive themes was a hot topic at WordCamp Europe 2018. During the event I had the opportunity to set up a panel with four experts who are working to integrate progressive web development practices more deeply in WordPress core, plugins, and themes. These practices make it possible for a website (or app) to work offline, load quickly, deliver content on unreliable networks, and use device-specific features to provide a better experience for the user. The PWA (progressive web app) created for WordCamp Europe is a good example of this in action.

Thierry Muller, Alberto Medina, Weston Ruter, and Morten Rand-Hendriksen joined me for an interview, exploring the future of WordPress themes in the era of progressive web development. (see video below)

“At the most abstract level, it’s all about user experience,” Medina said. “How do we maximize the pleasure that our users get when they use our websites? And delightfulness in this context means things like performance, speed, having content that isn’t blocked. If you think about themes built according to those principles, then we are basically seeking an awesome user experience in WordPress.”

It’s not yet clear what this will look like for the WordPress theme landscape, as current solutions are somewhat fragmented. WordPress contributors are working to standardize progressive technologies in core so the ecosystem can collaborate better together.

“There are many progressive themes being built these days,” Medina said. “One of the problems that is happening is that there is a lot of fragmentation. There’s a lot of plugins that are using service workers but in their own ways. What we want is to say, ‘This is the best way to do things,’ this is a uniform API to do it, and then enable progressive theme developers to take advantage of the core functionality.”

Currently, the prospect of setting up a WordPress site that uses progressive web technologies would be a daunting task for regular users, even if they are implementing existing solutions.

“There’s also a user aspect of it, because the people for whom we design WordPress, plugins, and themes, are the people who actually publish their own content onto the web,” Rand-Hendriksen said. “There’s a really valid question in how much should they need to know about how the web works to be able to publish some content. When they spin up a WordPress site, should we impose on them to know that they need to add all these optimization plugins and do all this other stuff just to make the site work properly? How much of that can be offloaded onto the theme itself, or plugins, or even WordPress core?”

The members of the panel are working together to on various projects and core contributions that will standardize the use of progressive enhancement technologies in WordPress.

“The goal is to have a common API for service workers so that plugins and themes can each install their own logic, just like they can enqueque their own scripts today,” Ruter said. “Also to be able to enqueue their own service workers and then core can manage the combination of them, as well as having a common app manifest that plugins and themes can collaborate on and have a single output into the page.”

This is how Rand-Hendriksen’s WP Rig starter theme project came about – to help developers take advantage of these best practices in the meantime, without having to figure out how to put all the pieces together.

“WP Rig gives you the platform to build a progressive theme that uses all the latest performance and WordPress best practices, in a convenient package, and over time it will evolve with these new progressive technologies,” Rand-Hendriksen said.

We also discussed AMP and Gutenberg compatibility, core support for web app manifests, and how the commercial theme industry will react to these new technologies. Check out the full interview in the video below.

Drupal blog: Design 4 Drupal: The future of JavaScript in Drupal

Main Drupal Feed - Fri, 06/29/2018 - 14:59

This blog has been re-posted and edited with permission from Dries Buytaert's blog. Please leave your comments on the original post.

Today, I gave a keynote presentation at the 10th annual Design 4 Drupal conference at MIT. I talked about the past, present and future of JavaScript, and how this evolution reinforces Drupal's commitment to be API-first, not API-only. I also included behind-the-scene insights into the Drupal community's administration UI and JavaScript modernization initiative, and why this approach presents an exciting future for JavaScript in Drupal.

If you are interested in viewing my keynote, you can download a copy of my slides (256 MB).

Thank you to Design 4 Drupal for having me and happy 10th anniversary!

Drupixels: Progressive Web App (PWA) integration with Drupal

Main Drupal Feed - Fri, 06/29/2018 - 12:41
A Progressive Web App (PWA) is a web app that uses modern web capabilities to deliver an app-like experience to users by combining features offered by most modern browsers with the benefits of mobile experience. Integration of PWA with Drupal makes Drupal inherit the latest web technologies and harness devices capabilities.

Axelerant Blog: Axelerant At Drupal Developer Days Lisbon 2018

Main Drupal Feed - Fri, 06/29/2018 - 10:16


Drupal Developer Days brings together people who contribute to the progress of Drupal from around the world. There are code sprints, workshops, sessions, BoFs, after parties (and after-after parties) and more.

WPTavern: WPWeekly Episode 322 – WP Engine Acquires StudioPress

Wordpress Planet - Fri, 06/29/2018 - 01:21

In this episode, John James Jacoby and I spend the first half of the show discussing WP Engine’s acquisition of StudioPress. We share reactions from social media, debate on whether it’s a good or bad thing for the WordPress ecosystem, and webhosts being at the top of the food chain.

We also talk about a recent security vulnerability that was publicly disclosed, ProsPress acquires AutomateWoo, and the release of Tide beta 1. Also of note, we identified an issue that causes John’s audio to turn into static. His audio should be fixed in the next episode.

Stories Discussed:

Why WP Engine is Acquiring StudioPress
An Important Announcement About the Future of StudioPress
WP Engine, a managed WordPress platform, raises $250M from Silver Lake
https://twitter.com/bgardner/status/1012011823279824901
AutomateWoo joins Prospress
AutomateWoo joins Prospress to Further eCommerce Automation on WooCommerce
Tide Beta 1 Released

WPWeekly Meta:

Next Episode: Wednesday, July 4th 3:00 P.M. Eastern

Subscribe to WordPress Weekly via Itunes

Subscribe to WordPress Weekly via RSS

Subscribe to WordPress Weekly via Stitcher Radio

Subscribe to WordPress Weekly via Google Play

Listen To Episode #322:

Dries Buytaert: Design 4 Drupal: The future of JavaScript in Drupal

Main Drupal Feed - Thu, 06/28/2018 - 23:44

Today, I gave a keynote presentation at the 10th annual Design 4 Drupal conference at MIT. I talked about the past, present and future of JavaScript, and how this evolution reinforces Drupal's commitment to be API-first, not API-only. I also included behind-the-scene insights into the Drupal community's administration UI and JavaScript modernization initiative, and why this approach presents an exciting future for JavaScript in Drupal.

If you are interested in viewing my keynote, you can download a copy of my slides (256 MB).

Thank you to Design 4 Drupal for having me and happy 10th anniversary!

WPTavern: Drop It Plugin Brings Gifs and Unsplash Photos to Gutenberg

Wordpress Planet - Thu, 06/28/2018 - 22:52

If you’re writing all your posts in the new Gutenberg editor but don’t want to give up convenient access to your fancy gifs and stock images, the new Drop It plugin has you covered. Riad Benguella, one of the engineers who is working on Gutenberg, created the plugin to offer one-click image insertion/upload from Unsplash.com.

Drop It adds a droplet icon to the Gutenberg sidebar that launches a search form for Unsplash.com or Giphy.com (a feature contributed by Julien Maury). Users can click the “+” sign on the image or simply drag and drop it into the content area.

Drop It seamlessly connects Gutenberg to the Unsplash and Giphy libraries, putting hundreds of thousands of stock photos and gifs at your fingertips while composing in WordPress. In the earlier days of Unsplash, many of the same images were used all over the web, but over the past few years its library has grown to include more than 550,000 high-resolution photos.

Check out this demo to see how how fast it is to search and insert images:

Benguella originally created the plugin for a talk he gave at WPtech Lyon where he demonstrated how plugin developers can make use of Gutenberg’s reusable modules. His presentation and slides explore Gutenberg’s architecture and show how he created the Drop It plugin.

Benguella said the Drop It plugin’s code is a good example of how developers can extend Gutenberg’s UI using “pinnable” sidebar plugins. It also shows how to use the Data module to access and update Gutenberg’s state (data).

In the future, Benguella plans to add more sources for inserting media. He currently has a proof of concept for adding content from Google Docs and will add more depending on contributions from others and his availability to work on the plugin.

Angie "webchick" Byron: An update on Drupal 8.6 pre-feature freeze

Main Drupal Feed - Thu, 06/28/2018 - 20:52

Greetings, folks! As we head into feature freeze for Drupal 8.6 (the week of July 18), here's a run-down of the various initiatives, and a hit-list of what they're trying to accomplish in the next two weeks. Patch reviews, testing, design, docs, and many more skills are very welcomed!

A couple of caveats here:

1) This is my own personal best understanding of where this stuff is all at, based on reading issue comments, attending meetings, overhearing things from other people who attended meetings, catching the odd Slack snippet of conversation, carrier piegon, etc. And therefore may not be 100% accurate, or even 80% accurate — there's a lot going on! (please clarify in the comments if you see any errors/omissions)
2) Just because something is listed here, there is absolutely no guarantee that it gets reviewed + (truly) RTBCed + committed in time for feature freeze and makes it into 8.6. As you can see, there are lots of issues in the list below, and we're all doing our best to stay on top of them. Worst-case, there's always 8.7. :)
3) This post gets into nitty-gritty "technical audience" details; if you're interested in a more broad overview of initiatives and their aims for 8.6 and beyond, there's the strategic initiatives overview on Drupal.org. I was also recently on a Lullbabot podcast to that effect.

OK, here we go! These are listed in alphabetical order.

Admin UI & JavaScript Modernization

This initiative has some lofty goals indeed, to redesign Drupal's admin experience, and modernize the underlying JavaScript code in Drupal to meet modern standards/best practices. While there's a ton of work actively going on in these areas right now, most of the fruit won't bear until 8.7 or later. If you're planning/able to go, come join the sprint next week at Drupal Developer Days Lisbon!

For 8.6, one of the big accomplishments of this initiative was introducing Nightwatch.js testing framework to core, which allows us to test JavaScript code with (wait for it)... JavaScript (what a concept!). This will be critical in ensuring that the React-ified components work as expected, and our existing JavaScript-rich functionality continues to work solidly as we expand on dynamic functionality in the UI.

Here are the issues this team has surfaced as important for 8.6:

Make Nightwatch testing more generally useful
  • Add login/logout commands to nightwatch [#2973879]
  • Create nightwatch command to install modules [#2974619]
Fix long-standing issues in the JavaScript system

Seriously, check out the five-digit node IDs on these bad boys! :P

  • ajax.js insert command sometimes wraps content in a div, potentially producing invalid HTML and other bugs [#736066]
  • Provide a common API for displaying JavaScript messages [#77245]
Bring JS code up to modern standards
  • Use Prettier for formatting core JavaScript [#2978964]
API-First

This team's 8.6 goals are two-fold: 1) stabilizing and filling gaps in the existing REST API, and 2) attempting to add JSON API to core.

TONS of work has been going on in the JSON API contributed module queue to fix a number of outstanding issues to make it core-worthy. So even if this module doesn't make it in time for 8.6, the entire ecosystem will benefit throughout 8.6's lifecycle by using a much more robust and well-tested contributed module. Additionally, a long-standing gap of file upload support has been added. Huzzah!

For the remainder of 8.6, the team would like to focus on the following:

Unblockers to API-First in general
  • Add DateTimeNormalizer+TimestampNormalizer, deprecate TimestampItemNormalizer: @DataType-level normalizers are reusable by JSON API [#2926508]
  • @DataType=map cannot be normalized, affects @FieldType=link, @FieldType=map [#2895532]
Unblockers to REST
  • EntityResource should add _entity_access requirement to REST routes [#2869426]
  • PATCHing entities validates the entire entity, also unmodified fields, so unmodified fields can throw validation errors [#2821077]
Unblockers to JSON API

These are all issues in the JSON API contrib module, which help unblock "Add experimental JSON API module [#2843147]" for core.

  • [PP-1] Work around core's ill-designed @FieldType-level TimestampItemNormalizer normalization until #2926508 lands [#2929932]
  • JSON API indicates it supports POST/PATCH/DELETE of config entity types, but that's impossible [#2887313]
  • Needs Issue: Module name conflict between contrib/core (what happens when we bring a same-named contrib module to core that sites are actively using?)
  • [>=8.5] Remove JSON API's "file URL" field work-around now that Drupal core 8.5 fixed it [#2926463] - Fixed!
Automatic Updates / Composer in Core

These two initiatives overlap in that we're aiming to build the automatic update functionality around improving core's underlying Composer support.

The Composer team has compiled an excellent plan of attack for how to provide Composer support without jeopardizing the site builder experience. Most of that work will take place in 8.7.

However, one of the pre-requisites for Composer to work well, is adding semantic versioning support for contrib. Support for this would also be tremendously helpful to contrib module authors and site builders, regardless if they use Composer to manage their dependencies or not.

Unblockers to semver for contrib
  • Core version key in module's .info.yml doesn't respect core semantic versioning [#2313917]
  • Module version dependency in .info.yml is ineffective for patch releases [#2641658]
Configuration Management 2.0

This team spent most of the 8.6 cycle forming, brainstorming a list of blockers to configuration awesomeness, and prioritizing those efforts. The hope is for a roadmap to get published after the sprint next week at Drupal Developer Days Lisbon.

One major win in 8.6 is the ability to Allow a site-specific profile to be installed from existing config, which is part of the aim to Allow a site to be installed from existing configuration (basically, moving the capabilities of the Config Installer module into core.)

Unblockers of install from existing configuration
  • Install a site from config if the config directory is set in settings.php [#2980670]
Documentation

The Documentation initiative has a lot on the go right now, from designing a top-level landing page for the new docs system, to taking a holistic look at the existing docs and how to refactor the IA around them, and finally creating a repository around "quick start" guides. None of these have a particular deadline around 8.6, because they're happening independently of core.

On the core side, there's work being done on a new experimental module for overhauling the in-app help system and this work has an 8.6 deadline.

New topic-based core help system
  • Refactor using a plugin system [#2961552]
  • Add experimental module for Help Topics [#2920309]
Extended Security Support

For the plan around this initiative to happen, we need to make several adjustments to core's Update Status module, which currently makes several hard-coded assumptions about the last minor release of Drupal expiring immediately once a new minor release is available.

Update Status Improvements
  • If the next minor version of core has a security release, status still says "Security update required!" even if the site is on an equivalent, secure release already [#2804155]
  • Status report should indicate next minor release date (needs issue)
  • (other issues TBD)
Layout

The Layout team has been hard at work improving upon the experimental Layout Builder functionality that was added to 8.5. The main goal of the team for 8.6 is to gather real-world testing feedback from end users, which they are accomplishing by adding Layout Builder to a new branch of the Lightning distribution. Doing this has uncovered a few holes in the implementation relative to what's possible in contrib right now, and filling those gaps is the focus of the remaining 8.6 time for the team.

Layout Builder gaps
  • Allow the inline creation of non-reusable Custom Blocks in the layout builder [#2957425]
  • Add a validation constraint to check if an entity has a field [#2976356]
  • Determine if Layout Builder should replace entity_view_display for all Entity Types [#2936358]
  • No ability to control "extra fields" with Layout Builder [#2953656]
  • Allow Custom blocks to be set as non-reusable adding access restriction based on where it was used. [#2976334]
Integration with other subsysytems/modules
  • [PP-1] LayoutBuilderEntityViewDisplay::getRuntimeSections() does not delegate to plugins [#2976148]
  • Add EntityContextDefinition for the 80% use case [#2932462]
  • [meta] Decide how Layout Builder should function with Content Moderation and Workspaces modules [#2973382]
  • Layout Builder does not respect translations [#2946333]
  • Track Layout override revisions on entities which support revisioning [#2937199]
Media

Media has made tremendous strides in 8.6, including remote video support and a newly designed media library.

Next, we need to integrate that media library into the node form, and ideally allow people to add from there as well in a more streamlined fashion.

Blockers to media awesomeness
  • Create a field widget for the Media library module [#2962525]
  • (needs issue) Mark Media Library as beta
  • [PP-1] Allow media to be uploaded with the Media Library field widget [#2938116]
  • Any AJAX call disregards machine name verification when AJAX is used and leads to a fatal error [#2557299]
Migrate

The goal of this initiative for 8.6 is to stabilize the migration system which means marking the experimental Migrate Drupal + Migrate UI modules stable. This was also the goal for 8.5. What's making it tricky is multilingual migrations, which are themselves tricky because there are a multitude of ways one might have set up multilingual functionality prior to it being included in core in Drupal 8, which introduces lots of edge cases around making IDs line up and whatnot.

The team is taking a two-pronged approach here:

1) Attempt to close all of the remaining i18n-related issues.
2) Worst-case, split off multilingual migrations to an experimental module, so that the rest of the system that works for 80%+ of sites can be marked stable.

Make Migrate Stable
  • [policy, no patch] Mark Migrate Drupal as stable [#2905736]
  • [policy, no patch] Mark Migrate Drupal UI as stable [#2905491]
  • [META] Multilingual migrations meta issue [#2208401]
  • Experimental migrate_drupal_multilingual module [#2953360]
Out-of-the-Box

The Umami profile was committed (albeit marked hidden) in 8.5, and major efforts have been going on to remove all of the "beta blockers" preventing it from being visible in the UI. The last of these—Install profile in settings.php and mismatch check makes re-installs of Drupal hard [#2975328]—just landed earlier this week!

From here to 8.6, the team is working on stability and accessibility improvements.

Umami awesomesaceness
  • Un-hide Umami in 8.5 to vastly improve Drupal's evaluator experience [#2957464]
  • Improve Umami demo's support for managing field display settings [#2980029]
  • Improve Umami Demo's header layout and responsive behaviour [#2980528]
  • Umami missing some Media "plumbing" found in Standard profile [#2939594]
Workflow

Last, but certainly not least, is the Workflow initiative, which aims to add the Workspace contributed module to core in 8.6 to facilitate content staging and full-site previews. The module was already committed to 8.6 awhile back, but must be brought up to "beta" level stability to remain in the tagged + shipped release.

Because Workspaces can only stage content that's revisionable, there's also a parallel effort to add revision-ability to more types of data in Drupal core.

Blockers to Workspaces Stability
  • WI: Workspace module roadmap [#2732071]
  • Add workspace UI in top dialog [#2949991]
  • Remove the automatic entity update system [#2976035]
MOAR revisionable thingies
  • Convert taxonomy terms to be revisionable [#2880149]
  • Convert custom menu links to be revisionable [#2880152]
  • Convert comments to be revisionable [#2880154]
Anything else?

Whew! That's QUITE a lot. Are there any issues out there that we're missing that you feel are mission-critical to get into Drupal 8.6? Feel free to suggest them, with the caveat that the longer the list is, the more distributed the community's and core committers' focus is.

Thanks for reading!

Tags: drupaldrupal 8drupal 8.6product manager hat

Matt: Automattic’s First New Board Member: General Ann Dunwoody

Wordpress Planet - Thu, 06/28/2018 - 19:54

As Automattic keeps growing we’ve been bringing in a lot of talented people behind the scenes to help expand on our vision as we go from hundreds to thousands of colleagues, and hundreds of millions to billions in revenue. Recently, former New York Times digital executive Kinsey Wilson joined our team as president of WordPress.com, the Chief Design Officer of Axios Alexis Lloyd has joined as head of Design Innovation, the former CEO of Bluehost James Grierson, and today I’m excited to announce a change to my bosses, the board of directors.

Gen. Ann Dunwoody served for 37 years in the U.S. Army, and she is the first woman in U.S. Military history to achieve a four-star officer rank. She’s also the author of A Higher Standard: Leadership Strategies from America’s First Female Four-Star General, a book I really loved and highly recommend. Automattic’s board has had no new members since its founding in 2005, so this is our first addition in 13 years. I became familiar with General Dunwoody’s work while researching distributed organizations outside of technology, which led me to the military, which led me to geek out on logistics, which led me to her book and eventually flying out to Florida to meet in person.

Below is a brief interview with Gen. Dunwoody — we chatted with her about global leadership, finding your passion, and building a business.

We’re excited to have you onboard, General Dunwoody. It’s interesting — at Automattic we like to point out that we’re all over the globe (over 740 employees in more than 60 countries) but you oversaw 69,000 military and civilians across 140 countries! Were there any big leadership lessons from managing operations across such a wide range of distances, timezones, and cultures?

That’s a great question. When I started out as a young officer in the Army, the leadership philosophy that was espoused back then was “Leadership by walking around.” When you’re in charge of a platoon, a company or even a battalion or Brigade that is not globally dispersed this philosophy is very sound. When you’re running a global organization with 69,000 folks in 140 countries, you have to leverage technology to keep real-time communications flowing and keep leaders updated. I would host (with the leadership) a global video teleconference every Wednesday connecting every organization from Afghanistan, Kuwait, Iraq, Europe, etc. and sites — hundreds across the United States. Our headquarters  would provide an operational update and then we go around the globe to get update from from everyone — what’s going well, where they need help or additional resources. In the old days I think people believed information was power and often withheld information to use for personal advantage, but I believe shared information is power. By leveraging the power of the entire industrial base we could solve problems in real time. I still travelled around a lot to see our people, but it is not possible to keep everyone informed and in the loop with current operations without leveraging technology.

I love your answer about “shared information is power.” Did you ever find it difficult to break down the silos and embrace that concept?

Oh my, yes. They weren’t just silos, they were silos with concertina wire around them!   Parochialism was rampant and everyone wanted their own system and own their own information. We had over 200 stand alone systems that didn’t talk to each other. So to field and design an enterprise IT system that leveraged systems with the needed information to support “foxhole to factory” was challenging and exciting.

And how did you decide what technological means to communicate an idea or a directive, versus, say, meeting in-person?

I would say it depended on the idea. If it was personal, probably a phone call (one on one); if trying to generate support for an idea or transformational concept, meet in-person with my initiatives group to socialize the idea and get their input modifications and buy-in. Then Commanders conference to socialize idea with them, as they will have to implement it. Once socialized with leadership, we worldwide videoconference with the entire organization to define and describe the purpose, intent, how, and why — so everyone knew what we were trying to do and what their role was in execution. I found you cannot over-communicate when trying to make changes.

It’s an incredible accomplishment to become the first woman in U.S. Military history to achieve the four-star officer rank. Can you tell me about how things changed (or maybe still need to change further) in terms of your experience during your 37 years of service, and how you addressed diversity and inclusion in the military?

First, I certainly didn’t accomplish this by myself — I had a lot of help along the way! I joined the Army as part of the Women’s Army Corps (WAC) back in 1975. A few years later they disestablished the WAC and began the integration of women into the regular Army. This was the first time women had the opportunity to have the same career opportunities as their male counterparts in the branches now open to women. The challenge for the women who came into the Army back then was to force the integration — fight being put into traditional jobs like being a secretary, admin, clerk, or cook — and fight to be platoon leaders, etc., to support and move the integration of women into the regular Army.

What I witnessed during my time in the Army was that the doors continued to open. Yes, there were roadblocks — but there were also many leaders along the way who were willing to help. I never worked for a woman. I worked for men who either believed in me or didn’t. My experience in my almost four decades was that the doors continued to open for women. I thought jumping out of airplanes was really neat — now my niece in the USAF is an A-10 fighter pilot, and we have women graduating from Ranger school!  

On diversity, I realized that being the only female in many forums, my voice was hard to be heard. And I also realized that most folks promoted and surrounded themselves with people in their own image. What my philosophy was — and I still think it is an issue today — is that diversity is not about numbers, it’s about getting the best and brightest from all walks of life, to help leaders solve the very complex issues that face us today. Don’t surround yourself with only people that think or act or look like you.

Who are the leaders that inspire you today?

I think we are products of our past — Mom and Dad, even though not here on earth, gave me the values that still guide me. Many of my military mentors, Gen. Hugh Shelton, Gen. Pete Schoomaker, Gen. Gordon Sullivan, Gen. Dick Cody, are still coaches and mentors to me today.  

Folks I admire: Warren Buffett, only met him once but I like his concern for the betterment of our country; Oprah Winfrey, although I have never met her I admire her for what she does for our country how she presents herself and how she handles herself — awesome; Gen. Mattis — wow, I admire him for taking on this extremely tough assignment for the good of our country and our defense. Secretary Gates served two administrations, Republican and Democrat.

People that inspire me are people I believe are true leaders — valuing honesty and having the best interests of the country at heart. No hubris!

WeKnow: Creating a Custom Ajax Command in Drupal 8

Main Drupal Feed - Thu, 06/28/2018 - 19:37
Creating a Custom Ajax Command in Drupal 8

Drupal 8 provides the option to include an Ajax Callback within our applications using the Ajax Framework. There are some existing functions which can be used: Methods to hide/show elements in the html document, attach content to an element, redirect a page after a submit, and so on. Sometimes we need to implement something particular, or a custom JS code. In that case, those out-of-the-box functions are not enough. Fortunately, we can also create our own custom responses. So, let’s start creating a new ajax callback for a custom form submission.

mcastillo Thu, 06/28/2018 - 19:37

OPTASY: What Are Some Quick and Easy Ways to Secure Drupal? 7-Step Security Checklist

Main Drupal Feed - Thu, 06/28/2018 - 15:16
What Are Some Quick and Easy Ways to Secure Drupal? 7-Step Security Checklist adriana.cacoveanu Thu, 06/28/2018 - 15:16

You have patched your Drupal website, haven't you? If so, then that critical 3-month-old security flaw Drupalgeddon2 can't get exploited on your site. Even so, with the menace of a cryptocurrency mining attack still lurking around the unpatched websites, you legitimately ask yourself: what are some quick and easy ways to secure Drupal?

“Which are the most basic steps to take and the simplest best practices to adopt to harden my Drupal site's security myself?”

Acro Media: Reducing Unnecessary Code Nesting in PHP

Main Drupal Feed - Thu, 06/28/2018 - 14:45

The majority of Drupal's underlying code is PHP. As a Drupal developer, the better you know PHP, the better your code will be. In this Acro Media Tech Talk video, Drupal developer Rob Thornton discusses code nesting and how you can optimize your code in order to reduce unnecessary nesting. 

Code nesting can basically be described as when a block of code is contained within another block of code. If you're code isn't well thought out, you can potentially end up with deep nesting that is both hard to read and difficult to maintain. Aside from reducing difficult to read code and making your code more maintainable, reducing the amount of nesting helps you find bugs and lets other developers contribute to your code easier. Rob uses a number of examples of common nesting scenarios, walking you through how to find and fix them.

If you liked this video, you might also like these posts too.

Drupal Europe: Drupal, DevOps and Infrastructures in the brave new world of Distributed Systems

Main Drupal Feed - Thu, 06/28/2018 - 13:55

Distributed systems face incredible challenges — Photo by Dennis van Zuijlekom

With Drupal 8 reaching its maturity and coupling/decoupling from other services — including itself — we have an increasing demand for Drupal sites to shine and make engaged teams thrive with good DevOps practices and resilient Infrastructure. All that done in the biggest Distributed System ever created by humans: the Internet. The biggest challenges of any distributed system are heterogeneity of systems and clients, transparency to the end user, openness to other systems, concurrency to support many users simultaneously, security, scalability on the fly and failure handling in a graceful way. Are we there yet?

We envision, in the DevOps + Infrastructure track, to see solutions from the smallest containers that can grow to millions of services to best practices in the DevOps world that accomplish very specific tasks to support Drupal and teams working on it and save precious human time, by reducing repetitive and automatable tasks.

Questions about container orchestration, virtualization and cloud infrastructure arise every day and we expect answers to come in the track sessions to deal with automation and scaling faster — maybe using applied machine learning or some other forms of prediction or self management. See? We’re really into saving time, by using technology to assist us.

We clearly don’t manage our sites in the same way we did years ago, due to increased complexity of what we manage and how we are managing change in process and culture, therefore it’s our goal at Drupal Europe to bring the best ideas, stories and lessons learned from each industry into the room and share them with the community.

What’s your story?

How is your platform scaling? How do you solve automated testing and continuous integrations? How do you keep your team’s happiness with feature velocity and still maintain a healthy platform? How do you make your website’s perceived performance even faster? What chain of tooling is running behind the scenes and what is controlling this chain? Are you using agentless configuration management or are you resorting to an agent. Are you triggering events based on system changes or do you work with command and control.

Be ready to raise, receive and answer some hard questions and but most of all, inspire people to think from a different angle. What works for a high-high traffic website might not be applicable for maintaining a massive amount of smaller sites. We want operations to inspire development on reliability and for development to inspire operations on any kind of automation. We want security to be always top of mind while still have an impact on business value rapidly and efficiently. And that is just the beginning…

About industry tracks

Drupal Europe’s 2018 program is focused on industry verticals, which means there are tons of subjects to discuss therefore when you submit your session be sure to choose the correct industry track in order to increase the chance of your session being selected.

Please help us to spread the word about this awesome conference. Our hashtag is #drupaleurope.

To recommend speakers or topics please get in touch at program@drupaleurope.org.

About the Drupal Europe Conference

Drupal is one of the leading open source technologies empowering digital solutions in the government space around the world.

Drupal Europe 2018 brings over 2,000 creators, innovators, and users of digital technologies from all over Europe and the rest of the world together for three days of intense and inspiring interaction.

Location & Dates

Drupal Europe will be held in Darmstadtium in Darmstadt, Germany — which has a direct connection to Frankfurt International Airport. Drupal Europe will take place 10–14 September 2018 with Drupal contribution opportunities every day. Keynotes, sessions, workshops and BoFs will be from Tuesday to Thursday.

Drupalcon Nashville — Photo by Amazee Labs

Blair Wadman: How to find which Twig template Drupal is using to output markup

Main Drupal Feed - Thu, 06/28/2018 - 08:14

One of the many changes in Drupal 8 is that all HTML output is rendered via a Twig template. This means that if you want to override the HTML for a given page, node, region or field, you can copy the Twig template that is being used to your theme and make your changes.

For any given page, node, region or field, there is normally more than one template that Drupal could use and it will choose the most specific one. So the question is, how do you know which template is being used? And if you override a template, how can you verify that your template is now used?

Pages