drupal8 https://www.millwoodonline.co.uk/taxonomy/term/4 en Drupal composer paranoia plugin https://www.millwoodonline.co.uk/blog/drupal-composer-paranoia-plugin <article role="article" about="/index.php/blog/drupal-composer-paranoia-plugin" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Drupal composer paranoia plugin" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:0" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/index.php/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2018-06-07T09:04:15+00:00">Thu, 07/06/2018 - 10:04</span> <span property="schema:dateCreated" content="2018-06-07T09:04:15+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Over the past few months one of my colleagues, Jean Ribeiro (<a href="https://www.drupal.org/u/jribeiro">jribeiro</a>), has been working in conjunction with Florian Weber (<a href="https://www.drupal.org/u/webflo">webflo</a>) from drupal-composer, on a composer plugin for added Drupal site security.</p> <p>The <a href="https://github.com/drupal-composer/drupal-paranoia">Drupal Paranoia</a> plugin works with two directories, <code>web</code> and <code>app</code>, although these can be renamed within you composer config to whatever works for you. The app directory is where all non-user facing code lives, this includes PHP, yaml, twig etc from core, contrib, and custom modules.The web directory then contains symlinks all user facing code, such as CSS, JS, and other files. It also contains stub PHP files for some items within the app directory.</p> <p>Within the plugin the public files directory is assumed to contain only user facing files, so it is symlinked. The codebase is then scanned for what are considered asset files. These are a fixed list of file extensions, which are expected to be used for module themeing and themes themselves, such as css, js, png, gif, etc. There is also a set list of "front controller" files, these are PHP files that do need to be user facing. The list includes <code>index.php</code>, <code>core/install.php</code>, <code>core/rebuild.php</code>, and <code>core/modules/statistics/statistics.php</code>. These files are then added via a stub PHP file, which calls the require function to pull them in.</p> <p>This plugin allows you to point your web server to the web directory without exposing any non-public files to users, giving an extra layer of security. There are no known specific security issues this will mitigate, however if there were any contrib or custom code with executable PHP code, this will update the codebase to make sure it's not remotely executable. For example in 2016 there was an<a href="https://www.drupal.org/forum/newsletters/security-advisories-for-contributed-projects/2016-07-13/coder-highly-critical"> issue found with coder module</a> were one of the executable PHP files opened a security hole. If anything like that were to happen again, you would be protected by using the <a href="https://github.com/drupal-composer/drupal-paranoia">Drupal Parnoia</a> plugin.</p> <p> </p> <p><em>Thanks to <a href="https://www.drupal.org/u/jribeiro">Jean Ribeiro</a> and <a href="https://www.drupal.org/u/badjava">Chad DeGoot</a> for helping write and review this blog post.</em></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/index.php/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/14" property="schema:about" hreflang="en">composer</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/34" property="schema:about" hreflang="en">plugin</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=49&amp;2=field_comment&amp;3=basic" token="eWWFfpdRX5FnI0fGfO_R6OLe0OCSRyfdUksf_JiQ4zc"></drupal-render-placeholder> </section> </div> </article> Thu, 07 Jun 2018 09:04:15 +0000 timmillwood 49 at https://www.millwoodonline.co.uk Workspace upgrade path https://www.millwoodonline.co.uk/blog/workspace-upgrade-path <article role="article" about="/blog/workspace-upgrade-path" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Workspace upgrade path" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:3" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2018-06-07T09:03:44+00:00">Thu, 07/06/2018 - 10:03</span> <span property="schema:dateCreated" content="2018-06-07T09:03:44+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>We've taken some time recently to discuss how we're going to handle the upgrade from the Workspace contrib module to the Workspace core module, once it's released. In our setup we have around 20 sites, each with 4 (or more) environments, all with Workspace installed, syncing content between each environments (and sometimes between each site). Therefore this is a task we are taking very seriously and want to make sure we have a super stable approach which will result in no loss of production content.</p> <p>The obvious idea is that we provide some kind of update hook that converts all of the workspaces to the new core module, along with all of their content. However, the new Workspace module is quite different in the way that it stores and handled entities, therefore this will be a lot of work. We don't have a lot of time to do a lot of work because we have to port Multiversion and Relaxed modules over to handle all the features that are not going into core. We also have "day job" work to do helping to build and support these 20+ sites.</p> <p>The idea we are looking to implement is a lot more simple. Uninstall the contrib Workspace module, and install the core Workspace module.</p> <p>Uninstalling the Workspace module (and all dependencies) will delete all workspaces, and all content in them. Therefore what you will be left with, effectively, is the live workspace and all live content. Installing the new module will recreate a live (and stage) workspace, and all content will be associated with the live workspace. There will be some kind of check available to see if all content has been synced up to the live workspace to prevent real data loss, but we see workspaces as <span>disposable anyway.</span></p> <p><span>Another option we are looking into is being able to replicate content off to another Drupal site (or CouchDB database), then do the uninstall / reinstall process, and sync content back. This will work well because the HTTP API used will be the same on both versions of Relaxed module. However, because of the number of moving parts here we feel the straight uninstall / reinstall process, dropping all non-live content, might actually provide better stability.</span></p> <p><span>This process will be fully documented in release notes and on Drupal.org when the time comes.</span></p> <p><span>It'd be great to hear any feedback from users of the contrib Workspace module if this approach would work.</span></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/taxonomy/term/8" property="schema:about" hreflang="en">drupal core</a></div> <div class="field--item"><a href="/taxonomy/term/33" property="schema:about" hreflang="en">workspace</a></div> </div> </div> <ul class="links inline list-inline"><li class="comment-add"><a href="/blog/workspace-upgrade-path#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul><section> <h2>Comment</h2> <a id="comment-1829"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1528806653"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Vijay(vijaycs85) (not verified)</span> on Sun, 10/06/2018 - 21:50</p> <a href="/comment/1829#comment-1829" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1829#comment-1829" class="permalink" rel="bookmark" hreflang="en">I have been thinking about…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>I have been thinking about this part especially after I installed contib workspace on 8.6.x core and got weird exception (which remains me to raise <a href="https://www.drupal.org/project/workspace/issues/2978699">this issue</a>)</p> <p>How does the install/unstall would react to module with same name? Is it still possible to use <code>\Drupal::service('module_installer')</code>?</p> <p>Uninstalling contrib workspace module means uninstalling replication and multiversion (dependecies) and probably installl again with core module?</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1829&amp;1=default&amp;2=en&amp;3=" token="QLCNpotWPyvpCcG_0Yq8X-ZGsriy5KhiEg9Wvt36Rpo"></drupal-render-placeholder> </div> </article> <div class="indented"><a id="comment-1830"></a> <article data-comment-user-id="1" class="js-comment"> <mark class="hidden" data-comment-timestamp="1528806728"></mark> <footer> <article typeof="schema:Person" about="/user/1"> </article> <p>Submitted by <span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span> on Tue, 12/06/2018 - 13:32</p> <p class="visually-hidden">In reply to <a href="/comment/1829#comment-1829" class="permalink" rel="bookmark" hreflang="en">I have been thinking about…</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Vijay(vijaycs85) (not verified)</span></p> <a href="/comment/1830#comment-1830" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1830#comment-1830" class="permalink" rel="bookmark" hreflang="en">You would need to uninstall …</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>You would need to uninstall (and remove Workspace contrib module) while still on 8.5.x, then upgrade to 8.6.x and enable the Workspace core module.</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1830&amp;1=default&amp;2=en&amp;3=" token="AgD7mSF2dFPyxNsaLi10WUpJtcpjL7XaQkhDzy7uBvk"></drupal-render-placeholder> </div> </article> <div class="indented"><a id="comment-1831"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1528987938"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Vijay (vijaycs85) (not verified)</span> on Tue, 12/06/2018 - 16:55</p> <p class="visually-hidden">In reply to <a href="/comment/1830#comment-1830" class="permalink" rel="bookmark" hreflang="en">You would need to uninstall …</a> by <span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></p> <a href="/comment/1831#comment-1831" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1831#comment-1831" class="permalink" rel="bookmark" hreflang="en">Got it, thanks!</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Got it, thanks!</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1831&amp;1=default&amp;2=en&amp;3=" token="whjkeHXp4X1hIPzwpBhh_ED8exVI7cM6xkHKxbYUL8U"></drupal-render-placeholder> </div> </article> </div></div> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=48&amp;2=field_comment&amp;3=basic" token="JVQ1tkQLjuM4Ht-20VNde6I6huvTHt2eWlWRcskNZBE"></drupal-render-placeholder> </section> </div> </article> Thu, 07 Jun 2018 09:03:44 +0000 timmillwood 48 at https://www.millwoodonline.co.uk Drupal core Workspace module https://www.millwoodonline.co.uk/blog/drupal-core-workspace-module <article role="article" about="/blog/drupal-core-workspace-module" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Drupal core Workspace module" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:4" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2018-05-04T14:46:47+00:00">Fri, 04/05/2018 - 15:46</span> <span property="schema:dateCreated" content="2018-05-04T14:46:47+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>The Workspace entity was first seen in the contrib module Multiversion on 1st June 2014. Back then the entity type was called "Content repository", it was renamed to "Workspace" in September 2014.</p> <p>On 22nd Febuary 2016 the Workspace module was created, which built upon the Multiversion module.</p> <p>The Workflow Initiative was announced in Dries' keynote DrupalCon New Orleans.</p> <p>Today the Workspace module landed in Drupal core as a new experimental module. This module is very different from the contrib Workspace module. It has no dependencies and now actually has a lot in common with the Drupal 7 module <a href="https://www.drupal.org/project/cps">CPS</a>.</p> <p>Please give the module a try, join us in the <a href="https://www.drupal.org/project/issues/drupal?component=workspace.module">issue queue</a>, and help us get Workspace module beta ready for 8.6.0-alpha1 in just over 2 months time.</p> <p><img src="https://www.millwoodonline.co.uk/sites/default/files/2018-05/workspace.gif" alt="Workspace demo" /></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/taxonomy/term/8" property="schema:about" hreflang="en">drupal core</a></div> </div> </div> <ul class="links inline list-inline"><li class="comment-add"><a href="/blog/drupal-core-workspace-module#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul><section> <h2>Comment</h2> <a id="comment-1820"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1526158644"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Wim Leers (not verified)</span> on Thu, 10/05/2018 - 11:21</p> <a href="/comment/1820#comment-1820" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1820#comment-1820" class="permalink" rel="bookmark" hreflang="en">Congrats! :)</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Congrats! :)</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1820&amp;1=default&amp;2=en&amp;3=" token="3VXxL-eQN7tOYxAoMEtQPinq1w_mF26oR1VgOja_aoI"></drupal-render-placeholder> </div> </article> <a id="comment-1822"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1526158644"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Paolo (not verified)</span> on Thu, 10/05/2018 - 12:16</p> <a href="/comment/1822#comment-1822" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1822#comment-1822" class="permalink" rel="bookmark" hreflang="en">It&#039;s amazing how you…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>It's amazing how you succeeded not to say a word about what this module is about... but hey, we know it's whole history!</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1822&amp;1=default&amp;2=en&amp;3=" token="avANjwuG1ZOCha6rDf8dikFaUn2SyFdmByUDXDMBS8Q"></drupal-render-placeholder> </div> </article> <a id="comment-1823"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1526158644"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Wilma Smith (not verified)</span> on Fri, 11/05/2018 - 14:40</p> <a href="/comment/1823#comment-1823" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1823#comment-1823" class="permalink" rel="bookmark" hreflang="en">Hello, I am not a developer…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Hello,<br /> I am not a developer, but I am interested in possibly useful Drupal modules and functionality. Workspace sounds like something useful, but I can't really discern from your introduction what it does. Could you please include some information on what Workspace does and for what purpose it woudl be useful?</p> <p>Thanks in advance for your information.<br /> regards, Wilma</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1823&amp;1=default&amp;2=en&amp;3=" token="jDB5MU7ut7msvv4JjaoiP7rQFLsCATf6nYK06zrvZyU"></drupal-render-placeholder> </div> </article> <a id="comment-1826"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1528987938"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Paul Rijke (not verified)</span> on Fri, 25/05/2018 - 22:17</p> <a href="/comment/1826#comment-1826" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1826#comment-1826" class="permalink" rel="bookmark" hreflang="en">It is a great succes ti get…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>It is a great success to get this in core. Thank you guys!</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1826&amp;1=default&amp;2=en&amp;3=" token="achegIzLv492t6qCukfy5m9r6x2d7mnBT1IHP-8w56A"></drupal-render-placeholder> </div> </article> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=46&amp;2=field_comment&amp;3=basic" token="biCwSqlVFOcJI6yHNg7zcy9HppBxfp_MbZMhW_tA1CI"></drupal-render-placeholder> </section> </div> </article> Fri, 04 May 2018 14:46:47 +0000 timmillwood 46 at https://www.millwoodonline.co.uk Getting started with React and Drupal https://www.millwoodonline.co.uk/blog/getting-started-with-react-and-drupal <article role="article" about="/blog/getting-started-with-react-and-drupal" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Getting started with React and Drupal" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:3" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2018-04-23T06:20:09+00:00">Mon, 23/04/2018 - 07:20</span> <span property="schema:dateCreated" content="2018-04-23T06:20:09+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Over the weekend I decided it was long overdue that I learnt React, or at least understood what all the fuss was about, so with npm in hand I installed yarn and started my quest.</p> <p>We're going to use <a href="https://github.com/facebook/create-react-app">Create React App</a> to setup our base React install. First install then run the command to create a react app called "drupal-react":<br /><code>npm install -g create-react-app<br /> create-react-app drupal-react<br /> cd drupal-react</code></p> <p>You can now run <code>npm start</code> (or <code>yarn start</code>) to start your app locally and open it in a browser. Here you'll see a React default page, this is all created from a React component called "App". If you take a look at the file src/App.js you will see the component and how the <code>render()</code> method returns the page HTML as <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a>. We need to replace to the code returned here to show some Drupal nodes, so how about replacing it with (or just adding) <code>&lt;NodeContainer /&gt;</code>. This will call a new component, so at the top of app.js we will also need to import that, so with the other import code add <code>import NodeContainer from './NodeContainer';</code>.</p> <p>Now to create the NodeContainer component. First we need to add the Axios library which we'll use to query the Drupal REST API, run <code>npm install axios --save</code>. Then create the file src/NodeContainer.js, and in there add the following code:<br /><code>import React, { Component } from 'react'<br /> import axios from 'axios'<br /><br /> class NodeContainer extends Component {<br />   constructor(props) {<br />     super(props)<br />     this.state = {<br />       nodes: []<br />     }<br />   }<br /><br />   componentDidMount() {<br />     axios.get('http://example.com/api/nodes')<br />     .then(response =&gt; {<br />       this.setState({nodes: response.data})<br />     })<br />     .catch(error =&gt; console.log(error))<br />   }<br /><br />   render() {<br />     return (<br />       &lt;ul&gt;<br />        {this.state.nodes.map((node) =&gt; {<br />           return(<br />            &lt;li={node.nid}&gt;{node.title}&lt;/li&gt;<br />           )<br />         })}<br />       &lt;/ul&gt;<br />     )<br />   }<br /><br /> }<br /><br /> export default NodeContainer</code></p> <p>At the top of the file React and Axios are both imported, the class for <code>NodeContainer</code> is then created. The constructor method is where we add the state <code>node</code>, <code>componentDidMount()</code> is called to get the nodes from the View /api/nodes, which then gets rendered as an unordered list.</p> <p>To create the /api/nodes view install the core Rest module. This will allow you to create a "REST Export" view. Here the path can be set to /api/nodes, and you can select nid, and title.</p> <p>As long as you left npm start running, you should be able to go back to your browser, and view a nice list of Drupal nodes being rendered in React.</p> <p>Next, routing, to make these node titles clickable! <span>😱</span></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/taxonomy/term/9" property="schema:about" hreflang="en">drupal development</a></div> <div class="field--item"><a href="/taxonomy/term/26" property="schema:about" hreflang="en">react</a></div> <div class="field--item"><a href="/taxonomy/term/27" property="schema:about" hreflang="en">reactjs</a></div> <div class="field--item"><a href="/taxonomy/term/28" property="schema:about" hreflang="en">javascript</a></div> </div> </div> <ul class="links inline list-inline"><li class="comment-add"><a href="/blog/getting-started-with-react-and-drupal#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul><section> <h2>Comment</h2> <a id="comment-1796"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1524559875"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">ygerasimov (not verified)</span> on Tue, 24/04/2018 - 02:05</p> <a href="/comment/1796#comment-1796" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1796#comment-1796" class="permalink" rel="bookmark" hreflang="en">Hey Tim, Thank you for…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Hey Tim,</p> <p>Thank you for putting this together.</p> <p>Any recommendations about material to learn plain React? Preferably with PHP as backend. Like laracasts for vuejs.</p> <p>Yuriy</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1796&amp;1=default&amp;2=en&amp;3=" token="n0eg9BNprgPtH0wNsfaCJI1Ztl6BlVCXD2Y9whi9MNM"></drupal-render-placeholder> </div> </article> <div class="indented"><a id="comment-1797"></a> <article data-comment-user-id="1" class="js-comment"> <mark class="hidden" data-comment-timestamp="1524560027"></mark> <footer> <article typeof="schema:Person" about="/user/1"> </article> <p>Submitted by <span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span> on Tue, 24/04/2018 - 09:53</p> <p class="visually-hidden">In reply to <a href="/comment/1796#comment-1796" class="permalink" rel="bookmark" hreflang="en">Hey Tim, Thank you for…</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">ygerasimov (not verified)</span></p> <a href="/comment/1797#comment-1797" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1797#comment-1797" class="permalink" rel="bookmark" hreflang="en">I started with React docs …</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>I started with React docs (<a href="https://reactjs.org/docs/hello-world.html">https://reactjs.org/docs/hello-world.html</a>), also looked Sitepoint (<a href="https://www.sitepoint.com/learn/react/">https://www.sitepoint.com/learn/react/</a>) and Lullabot (<a href="https://www.lullabot.com/articles/how-to-learn-react">https://www.lullabot.com/articles/how-to-learn-react</a>).</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1797&amp;1=default&amp;2=en&amp;3=" token="MEsgq6RKWiW72wASJ9-iH4dYoxsD5XRJ-5U_re3lfvU"></drupal-render-placeholder> </div> </article> </div><a id="comment-1798"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1524755103"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">dawehner (not verified)</span> on Tue, 24/04/2018 - 22:30</p> <a href="/comment/1798#comment-1798" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1798#comment-1798" class="permalink" rel="bookmark" hreflang="en">+1 for the official react…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>+1 for the official react docs. They got improved a lot over time.</p> <p>For more advanced tutorials I can recommend <a href="https://egghead.io/">https://egghead.io/</a> which is not fully free, but it is well done.</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1798&amp;1=default&amp;2=en&amp;3=" token="GA13uRswUHckkvN1kCaZQ8tYvUurkeBLPHxL9FSo2LE"></drupal-render-placeholder> </div> </article> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=44&amp;2=field_comment&amp;3=basic" token="6tdRzb_KucnJVgx1NkLq4i24_3-C-Lr841wCtq8uAhY"></drupal-render-placeholder> </section> </div> </article> Mon, 23 Apr 2018 06:20:09 +0000 timmillwood 44 at https://www.millwoodonline.co.uk Deprecation fails when testing Drupal 8 https://www.millwoodonline.co.uk/blog/deprecation-fails-when-testing-drupal-8 <article role="article" about="/blog/deprecation-fails-when-testing-drupal-8" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Deprecation fails when testing Drupal 8" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:2" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2018-02-26T08:57:15+00:00">Mon, 26/02/2018 - 08:57</span> <span property="schema:dateCreated" content="2018-02-26T08:57:15+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>With each release of Drupal 8 more and more things are being deprecated, which is awesome. It shows innovation, forward thinking, and a thought for backwards compatibility. However throwing notices or warnings when deprecated code is used can cause tests to fail. We already counter this a little by adding <code>&lt;env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors"&gt;</code> to phpunit.xml.dist in core.</p> <p>To quote the <a href="https://symfony.com/doc/current/components/phpunit_bridge.html#making-tests-fail">Symfony documentation</a>:</p> <blockquote>By using the <code>weak_vendors</code> value, deprecations that are triggered outside the <code class="notranslate">vendors</code> directory will make the test suite fail, while deprecations triggered from a library inside it will not, giving you the best of both worlds.</blockquote> <p>This shows that deprecations within Drupal will still cause test fails, to combat that simply update the SYMFONY_DEPRECATIONS_HELPER setting to "weak" or "disabled", which would ignore the deprecations or disable the deprecation helper.</p> <p>However if you're testing with run-test.sh this will interfere with the settings in your phpunit.xml file and use always use weak_vendors unless you have the suppress-deprecations argument set. Therefore use <code>run-tests.sh --suppress-deprecations</code> and the SYMFONY_DEPRECATIONS_HELPER setting will be set to "disabled". See the <code>simpletest_script_run_one_test()</code> function in run-tests.sh for more context.</p> <p>Hopefully this helps, we found this really useful when testing Drupal modules with Travis, where we needed tests passing for Drupal 8.4 and 8.5.</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/taxonomy/term/24" property="schema:about" hreflang="en">testing</a></div> <div class="field--item"><a href="/taxonomy/term/25" property="schema:about" hreflang="en">drupal testing</a></div> </div> </div> <ul class="links inline list-inline"><li class="comment-add"><a href="/blog/deprecation-fails-when-testing-drupal-8#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul><section> <h2>Comment</h2> <a id="comment-1527"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1519906034"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Pasqualle (not verified)</span> on Tue, 27/02/2018 - 21:36</p> <a href="/comment/1527#comment-1527" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1527#comment-1527" class="permalink" rel="bookmark" hreflang="en">Why don&#039;t we just remove the…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Why don't we just remove the use of deprecated code? It should have been done before every minor Drupal core release..</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1527&amp;1=default&amp;2=en&amp;3=" token="iGoVRnL-xQ7uFVdc1CekCbOtthrEupWd8ZYGEYN4lag"></drupal-render-placeholder> </div> </article> <div class="indented"><a id="comment-1531"></a> <article data-comment-user-id="1" class="js-comment"> <mark class="hidden" data-comment-timestamp="1519906094"></mark> <footer> <article typeof="schema:Person" about="/user/1"> </article> <p>Submitted by <span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span> on Thu, 01/03/2018 - 12:08</p> <p class="visually-hidden">In reply to <a href="/comment/1527#comment-1527" class="permalink" rel="bookmark" hreflang="en">Why don&#039;t we just remove the…</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Pasqualle (not verified)</span></p> <a href="/comment/1531#comment-1531" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1531#comment-1531" class="permalink" rel="bookmark" hreflang="en">My use case for this was a…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>My use case for this was a contrib module where I needed to support both 8.4.x and 8.5.x versions of core. Therefore couldn't remove the use of deprecated code.</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1531&amp;1=default&amp;2=en&amp;3=" token="sYMvH-lyRy4sZadabWcwPoCv7TgNFavGMQYxh9dCEZo"></drupal-render-placeholder> </div> </article> </div> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=41&amp;2=field_comment&amp;3=basic" token="aiw6YOvX0o1rAYnyIUSX__C3tp7y4ma2mG0_IBE3icU"></drupal-render-placeholder> </section> </div> </article> Mon, 26 Feb 2018 08:57:15 +0000 timmillwood 41 at https://www.millwoodonline.co.uk Drupal Service ID Collectors https://www.millwoodonline.co.uk/blog/drupal-service-id-collectors <article role="article" about="/blog/drupal-service-id-collectors" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Drupal Service ID Collectors" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:2" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2017-12-14T09:29:06+00:00">Thu, 14/12/2017 - 09:29</span> <span property="schema:dateCreated" content="2017-12-14T09:29:06+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Since Drupal 8 we've had services. This also brought the concept of a service collector or tagged services. This allows services to be tagged with a specific tag, then a service collector can collect all services with the a given tag and use whichever service "applies".</p> <p>As you could imagine loaded all of these tagged services when loading the service collector service can be a performance nightmare, which is why Drupal 8.4.0 brought us <a href="https://www.drupal.org/node/2598944">service ID collector functionality</a>.</p> <p>Tagging a service with the <code>service_id_collector</code> tag will pass all services with a given tag as the last parameter in the constructor. This will be an array of service IDs ordered by the priority. You will then need to use the <code>ClassResolver</code> service to lazily instantiate the collected service IDs.</p> <p><strong>my_module.services.yml</strong><br /><code>my_module.negotiator:<br />   class: \Drupal\my_module\MyModuleNegotiator<br />   arguments: {'@class.resolver'}<br />   tags:<br />     - { name: service_id_collector, tag: my_module_negotiator }<br /> my_module.negotiator.foo:<br />   class:\Drupal\my_module\FooNegotiator<br />   arguments: {'@entity_type.manager'}<br />   tags:<br />     - { name: my_module_negotiator, priority: 100 }<br /> my_module.negotiator.bar:<br />   class:\Drupal\my_module\BarNegotiator<br />   arguments: {'@entity_type.manager'}<br />   tags:<br />     - { name: my_module_negotiator, priority: -100 }<br /> my_module.negotiator.baz:<br />   class:\Drupal\my_module\BazNegotiator<br />   arguments: {'@entity_type.manager'}<br />   tags:<br />     - { name: my_module_negotiator, priority: 0 } </code></p> <p><strong>MyModuleNegotiator.php</strong><br /><code>/**<br />  * The negotiator for my module.<br />  */<br /> class MyModuleNegotiator {</code></p> <p>  /**<br />    * The class resolver service.<br />    *<br />    * @var \Drupal\Core\DependencyInjection\ClassResolver<br />    */<br />   protected $classResolver;</p> <p>  /**<br />    * The negotiator service IDs.<br />    *<br />    * @var array<br />    */<br />   protected $negotiatorServiceIds;</p> <p>  /**<br />    * Constructs the negotiator.<br />    *<br />    * @param \Drupal\Core\DependencyInjection\ClassResolver $class_resolver</p> <p>   *   The class resolver service.<br />    * @param array $negotiator_service_ids<br />    *   The negotiator service IDs.<br />    */</p> <p>  public function __construct(ClassResolverInterface $class_resolver, array $negotiator_service_ids) {<br />     $this-&gt;classResolver = $class_resolver;<br />     $this-&gt;negotiatorServiceIds = $negotiator_service_ids;<br />   }</p> <p>  /**<br />    * Run the negotiators.<br />    */<br />   public function runNegotiators() {<br />     foreach ($this-&gt;negotiatorServiceIds as $negotiator_service_id) {<br />       $negotiator = $this-&gt;classResolver-&gt;getInstanceFromDefinition($negotiator_service_id);<br />       if ($negotiator-&gt;applies()) {<br />         $negotiator-&gt;run();<br />       }<br />     }<br />   }<br /> } </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> </div> </div> <ul class="links inline list-inline"><li class="comment-add"><a href="/blog/drupal-service-id-collectors#comment-form" title="Share your thoughts and opinions." hreflang="en">Add new comment</a></li></ul><section> <h2>Comment</h2> <a id="comment-1068"></a> <article data-comment-user-id="0" class="js-comment"> <mark class="hidden" data-comment-timestamp="1513330033"></mark> <footer> <article typeof="schema:Person" about="/user/0"> </article> <p>Submitted by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Anonymous (not verified)</span> on Thu, 14/12/2017 - 13:14</p> <a href="/comment/1068#comment-1068" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1068#comment-1068" class="permalink" rel="bookmark" hreflang="en">Do you have any example of…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p>Do you have any example of how this is used in core or why someone may use a service collector?</p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1068&amp;1=default&amp;2=en&amp;3=" token="r5XUh20tzyT4by5PdMg0BzeOKFGaR4ouPQLTakNQtmc"></drupal-render-placeholder> </div> </article> <div class="indented"><a id="comment-1077"></a> <article data-comment-user-id="1" class="js-comment"> <mark class="hidden" data-comment-timestamp="1513330137"></mark> <footer> <article typeof="schema:Person" about="/user/1"> </article> <p>Submitted by <span lang="" about="/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span> on Fri, 15/12/2017 - 09:28</p> <p class="visually-hidden">In reply to <a href="/comment/1068#comment-1068" class="permalink" rel="bookmark" hreflang="en">Do you have any example of…</a> by <span lang="" typeof="schema:Person" property="schema:name" datatype="">Anonymous (not verified)</span></p> <a href="/comment/1077#comment-1077" hreflang="en">Permalink</a> </footer> <div> <h3><a href="/comment/1077#comment-1077" class="permalink" rel="bookmark" hreflang="en">theme.negotiator is a…</a></h3> <div class="field field--name-comment-body field--type-text-long field--label-hidden field--item"><p><code>theme.negotiator</code> is a service ID collector - <a href="https://api.drupal.org/api/drupal/core%21core.services.yml/service/theme.negotiator/8.4.x">https://api.drupal.org/api/drupal/core%21core.services.yml/service/theme.negotiator/8.4.x</a></p> </div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=1077&amp;1=default&amp;2=en&amp;3=" token="5oucln2XSQEPipwfaMc4l1h9PfsL206VfxrF69YKplo"></drupal-render-placeholder> </div> </article> </div> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=39&amp;2=field_comment&amp;3=basic" token="HTtXpZF2KBzblPquXs1Nc1VH0b9OqURLIyxl2uqb16c"></drupal-render-placeholder> </section> </div> </article> Thu, 14 Dec 2017 09:29:06 +0000 timmillwood 39 at https://www.millwoodonline.co.uk Workflow Initiative Needs Review https://www.millwoodonline.co.uk/node/2 <span property="schema:name">Workflow Initiative Needs Review</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>We have been extremely hard at work this year with the Workflow Initiative bringing some quite big underlying changes to the Entity API and some great advances in core such as the Content Moderation module. There are now around 8 weeks until feature freeze for 8.3.x and there’s still a number of key things we want to get in. Please take a look at our <a href="https://contribkanban.com/sprint/WorkflowInitiative" target="_blank">kanban board</a> and see if there’s anything you’d like to take a look at even if it’s just a quick review, a little feedback, or a +1.</p> <p>At the time of writing this post there are 8 Workflow Initiative issues in Needs Review:<br /><a href="https://www.drupal.org/node/2745619" target="_blank">Which core entities get revisions?</a><br /> We are looking at making more content entities in core revisionable, this will roll out gradually, but which ones should we make revisionable?<br /><br /><a href="https://www.drupal.org/node/2669802" target="_blank">Add a content entity form which allows to set revisions</a><br /> This is mainly an effort by the Media Initiative, but affects the Workflow Initiative too. The idea is to have a generic entity form for revisionable entities.<br /><br /><a href="https://www.drupal.org/node/2820848" target="_blank">Add a publishing status field to BlockContent</a><br /> Shock horror! Block content entities are currently not able to be unpublished. We need to fix this! This will be a pattern for making other things able to be unpublished too.<br /><br /><a href="https://www.drupal.org/node/2721313" target="_blank">Upgrade path between revisionable / non-revisionable entities</a><br /> This patch has had so many iterations but the current one is looking pretty awesome. It will give ups an upgrade path for entity types such as taxonomy terms and menu links to have revisions.<br /><br /><a href="https://www.drupal.org/node/2831428" target="_blank">Introduce sorted set key value store</a><br /> Before we introduce Workspaces in core we want to store a sequence of entity updates, a sorted set key value store will allow us to do this.<br /><br /><a href="https://www.drupal.org/node/2809227" target="_blank">Store revision id in originalRevisionId property to use after revision id is updated</a><br /> There are a number of bugs in core which require us to know what the revision id of an entity object used to be. This issue solves this by adding a simple property.<br /><br /><a href="https://www.drupal.org/node/2825973" target="_blank">Introduce a EditorialContentEntityBase class for revisionable and publishable entity types</a><br /> When we make more entity types revisionable and publishable it’d be great if they all extended the same base class. This issues does this for Nodes, we will then be able to roll it out to Block content once publishable, and other entities once revisionable.<br /><br /><a href="https://www.drupal.org/node/2755073" target="_blank">WI: Content Moderation module roadmap</a><br /> Content moderation is currently in core as an alpha experimental module. How can we get this to beta then stable?</p> </div> <span rel="schema:author"><span lang="" about="/index.php/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> <span property="schema:dateCreated" content="2016-12-08T10:49:19+00:00">Thu, 08/12/2016 - 10:49</span> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/index.php/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/6" property="schema:about" hreflang="en">workflow</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/7" property="schema:about" hreflang="en">workflow initiative</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=2&amp;2=field_comment&amp;3=basic" token="ECTd4hRDmbyR5E1D0bD0jmhhJg25mFgxgqpK8FzJs_g"></drupal-render-placeholder> </section> Thu, 08 Dec 2016 10:49:19 +0000 timmillwood 2 at https://www.millwoodonline.co.uk Core development is frickin’ hard https://www.millwoodonline.co.uk/node/3 <span property="schema:name">Core development is frickin’ hard</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>For the last 18 months I have been working full-time on Drupal workflow solutions, first with the Deploy suite of contrib modules, and now with the core Workflow Initiative.</p> <p>It turns out core is a lot harder than contrib. Everything we have mapped out in the plan for the Workflow Initiative is already done, and working, in the contrib modules. So getting it all in core should be easy, right. Just port over the code from the modules into core APIs or core modules and it’s done. Well… no.</p> <p>Everything in core needs to be generic, it needs to work for everyone. In contrib you can choose not to use module X if it’s not compatible with module Y, or if it doesn’t work with your use case, in core there is less of that luxury.</p> <p>Also in core everything has to be done “properly”. We can’t just get a solution that works well enough and run with it, we need to be sure it is the best (or least worse) solution.</p> <p>Some examples of the issues we are facing so far is with the <a href="https://www.drupal.org/node/2721313" target="_blank">Upgrade path between revisionable / non-revisionable entities</a> issue. In contrib we use the migrate module to migrate all content out, make entity types revisionable then migrate everything back. For core this is not stable enough so we need a custom set of update hooks. Then <a href="https://www.drupal.org/node/2725463" target="_blank">Add StatusItem field type to store archived state</a> in contrib we just add a new base field to all entity types to store the archived state. In core there are performance concerns with a new field and new conditions.</p> <p>Thankfully there are so many people working and thinking about things that will help some of these areas, and as we continue to develop core we should be able to make things easier.</p> </div> <span rel="schema:author"><span lang="" about="/index.php/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> <span property="schema:dateCreated" content="2016-09-06T13:25:34+00:00">Tue, 06/09/2016 - 14:25</span> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/index.php/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/8" property="schema:about" hreflang="en">drupal core</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=3&amp;2=field_comment&amp;3=basic" token="3idSt_XfrHPJ7CO3fRY0UwWzFV6r8qe7n8X4qhCndTU"></drupal-render-placeholder> </section> Tue, 06 Sep 2016 13:25:34 +0000 timmillwood 3 at https://www.millwoodonline.co.uk Content Moderation and Workspace module https://www.millwoodonline.co.uk/node/4 <span property="schema:name">Content Moderation and Workspace module</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Drupal 8.2.0 will see a bunch of new experimental modules. Once of these is Content Moderation. This is a port of the Drupal 8 release of Workbench Moderation, with a number of updates to make it suitable for core.</p> <p>Work is currently underway to get Content Moderation working for Workspaces. Workspaces, defined by the Workspace module and it’s dependency Multiversion, are a way of creating different versions of your site’s content and getting the elusive “full site preview” functionality. With Content Moderation you are able to moderate a whole Workspace. Then once published all content will be deployed to the live workspace.</p> <p>The screencast below shows adding some content on the Stage Workspace and confirming the content doesn’t exist on the Live Workspace. Then publishing the Stage Workspace results in the content being on both Workspaces.</p> <figure class="tmblr-embed tmblr-full" data-orig-height="304" data-orig-width="540" data-provider="youtube" data-url="https%3A%2F%2Fwww.youtube.com%2Fembed%2Fin4h5GU1Ox4"><iframe allowfullscreen="" frameborder="0" height="304" id="youtube_iframe" src="https://www.youtube.com/embed/in4h5GU1Ox4?feature=oembed&amp;enablejsapi=1&amp;origin=https://safe.txmblr.com&amp;wmode=opaque" width="540"></iframe></figure></div> <span rel="schema:author"><span lang="" about="/index.php/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> <span property="schema:dateCreated" content="2016-08-25T08:23:57+00:00">Thu, 25/08/2016 - 09:23</span> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/index.php/taxonomy/term/5" property="schema:about" hreflang="en">drupal 8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/9" property="schema:about" hreflang="en">drupal development</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/2" property="schema:about" hreflang="en">drupal-planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=4&amp;2=field_comment&amp;3=basic" token="uTl1eVRABWY3P_2_PUAEVYISR2N0G2XcJBan-KnK6UE"></drupal-render-placeholder> </section> Thu, 25 Aug 2016 08:23:57 +0000 timmillwood 4 at https://www.millwoodonline.co.uk Workflow Initiative: What am I doing? https://www.millwoodonline.co.uk/node/6 <article role="article" about="/index.php/node/6" typeof="schema:Article" class="article is-promoted full clearfix"> <span property="schema:name" content="Workflow Initiative: What am I doing?" class="hidden"></span> <span property="schema:interactionCount" content="UserComments:0" class="hidden"></span> <footer> <article typeof="schema:Person" about="/user/1"> </article> <div class="author"> Submitted by <span rel="schema:author"><span lang="" about="/index.php/user/1" typeof="schema:Person" property="schema:name" datatype="">timmillwood</span></span> on <span property="schema:dateCreated" content="2016-06-27T15:45:52+00:00">Mon, 27/06/2016 - 16:45</span> <span property="schema:dateCreated" content="2016-06-27T15:45:52+00:00" class="hidden"></span> </div> </footer> <div class="content"> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>The Workflow Initiative was announced just over a month ago and since then I have been working on the first phases full-time. Here’s what I’ve touched:</p> <p>In Drupal 8.1.x the RevisionLogInterface was introduced, but not used. In 8.2.x the <a href="https://www.drupal.org/node/2705433" target="_blank">Node entity will use it</a>. Also <a href="https://www.drupal.org/node/2716081" target="_blank">BlockContent entity will use it</a>.</p> <p>When we make everything revisionable we’ll need all entities to get their base fields from the base class. So from 8.2.x <a href="https://www.drupal.org/node/2707255" target="_blank">all content entities inherit their base fields</a>.</p> <p>To help people make sensible decisions <a href="https://www.drupal.org/node/2490136" target="_blank">Node revisions will now be enabled by default</a>.</p> <p>We got into a pretty annoying issue when trying to add revision fields to entities which already had data because the revision field couldn’t be set to NOT NULL. Andrei wrote an <a href="https://www.drupal.org/node/2753475" target="_blank">awesome patch to allow an initial from field to be set</a>. We therefore set the revision id as the entity id.</p> <p>When we make everything revisionable we’ll need an upgrade path, to test this the <a href="https://www.drupal.org/node/2721313" target="_blank">Shortcut entity is being upgraded to revisionable by a new service</a>. This has still not been committed, so reviews are welcome.</p> <p>We’re trying to get <a href="https://www.drupal.org/node/2725533" target="_blank">Workbench Moderation into core as Content Moderation</a>. Still lots to do to make this happen, but the patch is there with passing tests.</p> <p>Initial work has also started to <a href="https://www.drupal.org/node/2725463" target="_blank">get an archive field into all entities</a>. This will allow us to have CRAP (create, read, archive, purge) workflow, create a trash system, and replicate entity deletion through environments.</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/index.php/taxonomy/term/1" property="schema:about" hreflang="en">drupal planet</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/4" property="schema:about" hreflang="en">drupal8</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/9" property="schema:about" hreflang="en">drupal development</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/3" property="schema:about" hreflang="en">drupal</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/7" property="schema:about" hreflang="en">workflow initiative</a></div> <div class="field--item"><a href="/index.php/taxonomy/term/6" property="schema:about" hreflang="en">workflow</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=6&amp;2=field_comment&amp;3=basic" token="p8ZETAHxN4DtU14149icmS2Pgd3JEDfly4nSOwKs3v4"></drupal-render-placeholder> </section> </div> </article> Mon, 27 Jun 2016 15:45:52 +0000 timmillwood 6 at https://www.millwoodonline.co.uk