<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Christophe Jossart on Medium]]></title>
        <description><![CDATA[Stories by Christophe Jossart on Medium]]></description>
        <link>https://medium.com/@colorfield?source=rss-ed65d74666c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*q_g-uX980CSEMLZs.jpg</url>
            <title>Stories by Christophe Jossart on Medium</title>
            <link>https://medium.com/@colorfield?source=rss-ed65d74666c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:13:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@colorfield/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Drupal and Docker the easy way with Lando]]></title>
            <link>https://medium.com/@colorfield/drupal-and-docker-the-easy-way-with-lando-ab7322717b2d?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab7322717b2d</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[lando]]></category>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Wed, 07 Mar 2018 10:06:26 GMT</pubDate>
            <atom:updated>2018-03-07T10:45:40.207Z</atom:updated>
            <content:encoded><![CDATA[<p>Originally posted on <a href="https://colorfield.be/blog/drupal-and-docker-the-easy-way-with-lando">colorfield.be</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*iiZrRQVDAWaKrBwN." /></figure><p>Ever thought about spinning up a Drupal 7 or 8 dev environment that is close to your production setup in minutes (Apache or Nginx, PHP 5.6 or 7.1, MySQL or Postgres, or …)? Even better, you will be able to share the configuration with your team straight on your Git repository as a YAML file.</p><p>Lando provides development environments (LAMP, LEMP, MEAN, …) and other <em>recipes</em> for Drupal 6 to 8, Laravel, Backdrop, … .</p><blockquote><em>Lando is for developers who want to quickly specify and painlessly spin up the services and tools needed to develop their projects. It’s a free, open source, cross-platform, local development environment and DevOps tool built on </em><a href="http://docker.com/"><em>Docker</em></a><em> container technology.</em></blockquote><h3>Install Lando</h3><p>For Mac OS, download the latest version on <a href="https://github.com/lando/lando/releases">GitHub</a>.<br><a href="https://docs.devwithlando.io/installation/installing.html">More info and other platforms</a></p><h3>Init a Drupal 8 environment</h3><p>Lando strength is close to zero configuration. You can override it if needed, but by default your setup for this recipe will be Apache, PHP 7.1 and MySQL 5.7.</p><pre># Create a Drupal project. Assumes that you have Composer installed.<br>composer create-project drupal-composer/drupal-project:8.x-dev my_drupal_project --stability dev --no-interaction</pre><pre># Cd into the created directory.<br>cd my_drupal_project</pre><pre># Launch the interactive session.<br>lando init</pre><pre># Or just specify the Drupal 8 recipe.<br>lando init --recipe drupal8</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/0*WBgsrK0Sd6wLlEIx.png" /></figure><h3>Get app information</h3><pre>lando info</pre><p>This command will print the default config from the recipe : PHP version, MySQL credentials, …</p><pre>{<br>  &quot;appserver&quot;: {<br>    &quot;type&quot;: &quot;php&quot;,<br>    &quot;version&quot;: &quot;7.1&quot;,<br>    &quot;via&quot;: &quot;apache&quot;,<br>    &quot;webroot&quot;: &quot;web&quot;,<br>    &quot;config&quot;: {<br>      &quot;conf&quot;: &quot;/Users/christophe/.lando/services/config/drupal8/php.ini&quot;<br>    }<br>  },<br>  &quot;database&quot;: {<br>    &quot;type&quot;: &quot;mysql&quot;,<br>    &quot;version&quot;: &quot;latest&quot;,<br>    &quot;creds&quot;: {<br>      &quot;user&quot;: &quot;drupal8&quot;,<br>      &quot;password&quot;: &quot;drupal8&quot;,<br>      &quot;database&quot;: &quot;drupal8&quot;<br>    },<br>    &quot;internal_connection&quot;: {<br>      &quot;host&quot;: &quot;database&quot;,<br>      &quot;port&quot;: 3306<br>    },<br>    &quot;external_connection&quot;: {<br>      &quot;host&quot;: &quot;localhost&quot;,<br>      &quot;port&quot;: true<br>    },<br>    &quot;config&quot;: {<br>      &quot;confd&quot;: &quot;/Users/christophe/.lando/services/config/drupal8/mysql&quot;<br>    }<br>  }<br>}</pre><h3>Start your environment</h3><pre>lando start</pre><p>Noticed the enabled SSL? Sweet!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/0*AlEBSnpgMZFLDpee.png" /></figure><h3>Install your site with Drush</h3><pre>lando drush site-install standard --account-name=admin --account-pass=admin --db-url=&#39;mysql://drupal8:drupal8@database/drupal8&#39; --site-name=Dev85</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*NoidbSTXmj2oU2KZ.png" /></figure><p>Among other tools, in the Drupal 8 recipe, we now have</p><ul><li>lando composer</li><li>lando db-import / db-export</li><li>lando drupal</li><li>lando mysql</li><li>lando php</li></ul><p>Just run <em>`lando`</em> for a complete list of commands.</p><h3>Add a service</h3><p>Optionaly if you want to finetune your setup, go to the .lando.yml file.<br> As an example, here we will add Mailhog to catch outbound mails:</p><pre># Configuration provided by the `lando init` command.<br>name: drupal-85-dev<br>recipe: drupal8<br>config:<br>  webroot: web</pre><pre># Proxy settings so we get a nice URL for the mailhog ui.<br>proxy:<br>  mailhog:<br>    - mail.drupal8.lndo.site<br>services:<br>  # Spin up a mailhog container called &quot;mailhog&quot; or whatever, the name is arbitrary.<br>  mailhog:<br>    # Use the latest version<br>    type: mailhog<br>    # Mailhog expects that these services will be php services.<br>    hogfrom:<br>      - appserver<br>    # Optional access at localhost:1026<br>    portforward: 1026</pre><p>Then restart Lando.</p><pre>lando restart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/0*RIgOUi-JXADrXCZr.png" /></figure><p>Now Elasticsearch, Solr, Varnish, Redis, Mongo, … are at your fingertips 🚀<br>BOOMSHAKALAKA!!!</p><p>Here is a starter for several databases, MailHog, PhpMyAdmin. If you modified your existing configuration, run `lando rebuild` then.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db1479ddf015e4d04fa0dc1dc3745321/href">https://medium.com/media/db1479ddf015e4d04fa0dc1dc3745321/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab7322717b2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install Solr 7 for Drupal 8 Search API on Ubuntu 16.04]]></title>
            <link>https://medium.com/@colorfield/install-solr-7-for-drupal-8-search-api-on-ubuntu-16-04-60e1fabdf438?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/60e1fabdf438</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[drupal]]></category>
            <category><![CDATA[solr]]></category>
            <category><![CDATA[search]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Wed, 24 Jan 2018 09:03:04 GMT</pubDate>
            <atom:updated>2018-01-24T09:03:04.471Z</atom:updated>
            <content:encoded><![CDATA[<p>Originally posted on <a href="https://colorfield.be/blog/install-solr-7-drupal-8-search-api-ubuntu-1604">colorfield.be</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*-g9Zlgi-fY72NaDrVHgf1Q.png" /></figure><p>Before we start, here is an Amazon like demo of Search API given by Joris Vercammen (borisson_) at the Drupal Camp Antwerp 2017.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FBxcSXfe8ltQ%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DBxcSXfe8ltQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FBxcSXfe8ltQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa114700aca465cf3cdd29ac350bde5a/href">https://medium.com/media/fa114700aca465cf3cdd29ac350bde5a/href</a></iframe><h3>1. Install Solr</h3><h4>Install Java 9</h4><p>Note that if you already have Java 8 installed, it is still useable with Solr 7.</p><pre># Add the PPA<br>sudo add-apt-repository ppa:webupd8team/java<br># Update the package repository<br>sudo apt-get update<br># Download and install<br>sudo apt install oracle-java9-installer<br># Set Oracle JDK9 as default<br>sudo apt install oracle-java9-set-default</pre><p>Test Java</p><pre>java -version</pre><p>It should print something like:<br><em>java version “</em><strong><em>9.0.4</em></strong><em>”<br> Java(TM) SE Runtime Environment (build 9.0.4+11)<br> Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)</em></p><h4>Install Solr as a service</h4><pre>cd ~<br># get the latest 7.x release via https://lucene.apache.org/solr/mirrors-solr-latest-redir.html<br>wget http://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.tgz<br># extract the service installation file<br>tar xzf solr-7.2.1.tgz solr-7.2.1/bin/install_solr_service.sh --strip-components=2<br># install Solr as a service<br>sudo ./install_solr_service.sh solr-7.2.1.tgz</pre><p>Check then the Solr status.</p><pre>service solr status</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*vY90x-vwHuq_nfYO.png" /></figure><h3>2. Get the Search API Solr module</h3><p>This command will get the module and its dependencies (Search API module and vendors).<br> Get the <strong>2.x version</strong> as 1.x does not support Solr 7 (and will not).<br> Also, Search API 2.x merges <a href="https://www.drupal.org/project/search_api_solr_multilingual">Search API Multilingual Solr Search</a> and <a href="https://www.drupal.org/sandbox/dcam/2867828">Search API Datasource</a>.</p><p>We are using 2.0-alpha2 at the time of writing, with Drupal 8.4.x</p><pre>composer require drupal/search_api_solr:^2.0</pre><h3>3. Configure Solr for Search API</h3><p>Create a collection (also known as ‘core’) and replace the default Solr configuration by the one that is shipped with the Search API module.</p><pre># Create your collection<br>sudo su - solr -c &quot;/opt/solr/bin/solr create -c my_collection -n data_driven_schema_configs&quot;</pre><pre># Go to the collection directory and get the Search API schema<br># Become root first<br>sudo su<br># Then go to the Solr collections directory<br>cd /var/solr/data/my_collection<br># Keep a copy of the original config (or just rm -Rf conf)<br>mv conf conf.orig<br># Copy the Search API Solr configuration from your contributed modules directory<br>cp -R /var/www/my_site/docroot/modules/contrib/search_api_solr/solr-conf/7.x conf</pre><pre># Change owner and group<br>chown -R solr:solr conf<br># Change permissions<br>chmod -R 775 conf</pre><pre># Restart Solr service<br>service solr restart</pre><pre># Exit root session<br>exit</pre><h3>4. Install and configure Search API Solr</h3><p>Enable the <strong>Search API Solr</strong> and the <strong>Solr Search Defaults</strong> modules, this last one comes with a default content index configuration and can be uninstalled once the configuration has been created.</p><pre># cd in your docroot then<br>drush en search_api_solr search_api_solr_defaults</pre><p>This command will enable the following modules: <em>search_api_solr, search_api_solr_defaults, search_api, language</em>.</p><p>Go to the Search API configuration under <em>/admin/config/search/search-api</em> and edit the <em>Solr Server</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*zts_erUtKlMUXgLk.png" /></figure><p>Then set the name of your collection under the Solr core field.<br> Other values can be left as is in this basic configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*ro5EFwESYwEgJKwm.png" /></figure><p>Uninstall the <em>Solr Search Defaults</em> module as we now have the configuration.</p><pre>drush pmu search_api_solr_defaults -</pre><p>If not done yet, disable the core Search, because it is now duplicated with Search API and it is a <a href="https://www.drupal.org/node/2010146#core-search">performance issue</a>.</p><pre>drush pmu search -y</pre><h3>5. Configure your Solr content index</h3><p>You can then continue by finetuning the default index to your needs (<em>Configuration &gt; Search API</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/0*kN4IJLrImPmOpYrI.png" /></figure><p>There you can define :</p><ul><li>The <strong>data sources</strong>: entity types that can be exposed. Defaults to ‘Content’ (nodes), but can apply to User, Blocks, Taxonomy vocabulary, File, …</li><li><strong>Fields</strong> that you can then use in your Search API index View.</li><li><strong>Processors </strong>will handle content access, highlighting, case and charachters insensitive search, stemming, …</li></ul><p>Once you are done, if necessary, you can edit the Solr search content View that has been created by the Solr Search Defaults module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/0*fdxKV_Hbf68iIeY2.png" /></figure><h3>6. Generate some content</h3><p>If you have nothing to search on to test your configuration, let’s fix this by using Devel Generate.</p><pre># Get the Devel module<br>composer require drupal/devel<br># Enable Devel Generate<br>drush en devel_generate -y<br># Generate some articles<br>drush genc 20 --types=article</pre><h3>7. Related modules</h3><p>Here is a short list of modules that are part of the Search API ecosystem for Drupal 8.</p><ul><li><a href="https://www.drupal.org/project/facets">Facets</a></li><li><a href="https://www.drupal.org/project/search_api_autocomplete">Search API autocomplete</a></li><li><a href="https://www.drupal.org/project/search_api_attachments">Search API attachments</a></li><li><a href="https://www.drupal.org/project/search_api_sorts">Search API sorts</a></li><li><a href="https://www.drupal.org/project/search_api_location">Search API Location</a></li></ul><h3>Resources</h3><ul><li>Electric Citizen <a href="https://www.electriccitizen.com/blog/drupal-8-custom-site-search-search-api">Drupal 8 Custom Site Search with Search API</a></li><li>Matt Glaman <a href="https://glamanate.com/blog/using-json-api-query-your-search-api-indexes">Using JSON API to query your Search API indexes</a></li><li>Drupal.org <a href="https://www.drupal.org/docs/8/modules/search-api">Search API documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e1fabdf438" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React and Drupal 8 with JSON API 3/3]]></title>
            <link>https://medium.com/@colorfield/react-and-drupal-8-with-json-api-3-3-b70120ac8274?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b70120ac8274</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[decoupling]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[drupal]]></category>
            <category><![CDATA[json-api]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Thu, 18 Jan 2018 08:15:27 GMT</pubDate>
            <atom:updated>2018-01-18T08:15:27.757Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://colorfield.be/blog/react-and-drupal-8-json-api-3">Originally posted on colorfield.be</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*JDV1VwDj999FYxLUVIeFcQ.png" /></figure><p>The <a href="https://colorfield.be/blog/react-and-drupal-8-json-api-1">first post</a> was about setting up the Drupal and React environment, <a href="https://colorfield.be/blog/react-and-drupal-8-json-api-2">the second</a> explained the concepts of component, route, fetch data from JSON API and localization.</p><p>This one focuses on translation issues and various pitfalls that you might encounter while building with React and Drupal. Knowing this, prefer the demos and documentation that have been build around <a href="http://www.contentacms.org/">Contenta</a> and <a href="https://www.drupal.org/docs/8/modules/json-api/api-overview">Drupal JSON API</a> if you are looking for a more general introduction.</p><p>Following the second post example, here is the content model for an audioguide used by a film museum:</p><ul><li>Itinerary (Drupal vocabulary) and Stop (Drupal content type):<br>an itinerary has several “stops”, that are obviously places to stop and listen to a track of an audioguide. We define a term reference to the itinerary vocabulary on the stop content type.<br><em>Example: “The Maltese Falcon” and “You Only Live Once” stops have a reference to the “Adult” itinerary.</em></li><li>Each Drupal entities (nodes and terms) are <em>fully translatable</em> and exposed with JSON API.</li></ul><p>We will discuss the following points:</p><ul><li>Filter stops by itinerary (e.g. adult, child, …), so we can demonstrate taxonomy term filtering.</li><li>Custom sort, using the Weight module.</li><li>Full multilingual support: localization and internationalization with and without node language fallback.</li><li>Get images, with image styles.</li><li>Fetch data on the route or the component.</li><li>How to deploy in production.</li></ul><h3>Documentation and code example</h3><p>An update of the demo repositories (React and Drupal ones) is on its way.<br>It will contain a readme with a summary of the steps for getting started on a local dev environment.<br>The React repo will also describe the components used in the application and provide various examples, that are a bit long to describe in a single post, like: searching, fetching and displaying nested data structure like Paragraphs, …</p><h4>Boilerplate update</h4><p>The code from the <a href="https://colorfield.be/blog/react-and-drupal-8-json-api-2">previous article</a> will also be updated to the latest release of the <a href="https://github.com/kriasoft/react-starter-kit">React Starter Kit boilerplate</a> that now includes React 16.2.0.</p><h3>Languages</h3><h4>Localization: translate the UI with React Intl</h4><p>LANGUAGE SETUP</p><p>Here is an update of the second part of the tutorial for the React 16.2.0 <a href="https://github.com/kriasoft/react-starter-kit/tree/feature/react-intl">React Intl branch</a> of the boilerplate.</p><p>Edit the <em>src/config.js</em> file</p><pre>module.exports = {<br>  <em>// default locale is the first one</em><br>  locales: [<br>    <em>/* @intl-code-template &#39;${lang}-${COUNTRY}&#39;, */</em><br>    &#39;en-US&#39;,<br>    &#39;fr-BE&#39;,<br>    <em>/* @intl-code-template-end */</em><br>  ],<br>}</pre><p>Edit the <em>src/components/LanguageSwitcher/LanguageSwitcher.js</em></p><pre><strong>const</strong> localeDict = {<br>  <em>/* @intl-code-template &#39;${lang}-${COUNTRY}&#39;: &#39;${Name}&#39;, */</em><br>  &#39;en-US&#39;: &#39;English&#39;,<br>  &#39;fr-BE&#39;: &#39;Français&#39;,<br>  <em>/* @intl-code-template-end */</em><br>};</pre><p>Add your locale in <em>src/client.js</em></p><pre>import en from &#39;react-intl/locale-data/en&#39;;<br>import fr from &#39;react-intl/locale-data/fr&#39;;<br>(...)<br>[en, fr].forEach(addLocaleData);</pre><p>If you want to change the default language, edit also the <em>src/actions/intl.js</em></p><pre>defaultLocale: &#39;fr-BE&#39;,</pre><p>Run yarn build after having made your changes to languages, so the messages defined in your components will be extracted in one file per language in <em>/src/messages</em>.</p><p>MESSAGES</p><p>You can define translatable messages in your components.<br>The <em>defaultMessage</em> and (optionaly) the <em>description</em> will be the ones that will be translatable after the extraction.</p><pre><em>// Above the class definition. </em><br><strong>const</strong> messages = defineMessages({<br>  search_description: {<br>    id: &#39;search.description&#39;,<br>    defaultMessage: &#39;Search using stop id or title.&#39;,<br>    description: &#39;Description for the search input&#39;,<br>  },<br>  search_placeholder: {<br>    id: &#39;search.placeholder&#39;,<br>    defaultMessage: &#39;Search...&#39;,<br>    description: &#39;Search input placeholder&#39;,<br>  },<br>});<br>(...)<br><em>// In the render() method.</em><br>&lt;FormattedMessage {...messages.search_label} /&gt;</pre><p>The tricky part for placeholders</p><p>But if you need to define a placeholder (e.g. for the search input field) the <em>&lt;FormattedMessage /&gt;</em> does not fit.<br>You will have to use <em>injectIntl</em>.</p><pre>import { defineMessages, injectIntl, intlShape } from &#39;react-intl&#39;;<br>(...)<br>static propTypes = {<br>  intl: intlShape.isRequired,<br>}<br>(...)<br>export <strong>default</strong> injectIntl(withStyles(s)(SearchBar));</pre><p>Then you can use React Intl for plain strings like html attributes.</p><pre>&lt;input<br>  placeholder={formatMessage(messages.search_placeholder)}<br>  value={this.props.filterText}<br>  onChange={this.handleFilterTextChange}<br>/&gt;</pre><p>Here is an <a href="https://github.com/yahoo/react-intl/issues/162">issue</a> that tells a bit more about that.</p><h4>Internationalization: get translated content with JSON API from Drupal</h4><p>Filtering content by language can be done with the Drupal language id on the path. It is still a workaround that is explained by @e0ipso in <a href="https://www.youtube.com/watch?v=k5Yx9-bAXzA&amp;list=PLZOQ_ZMpYrZsyO-3IstImK1okrpfAjuMZ&amp;index=20">this video about content translation</a> from the JSON API Drupal YouTube channel.</p><pre>// JSON API request <strong>for</strong> translated stop nodes.<br>const languageId = &#39;fr&#39;;<br>const nodes = `${JSON_API_URL}/${languageId}/jsonapi/node/stop`;</pre><p>BUT WAIT… I DO NOT WANT LANGUAGE FALLBACK</p><p>The request above will produce language fallback, so if your Drupal node is not translated, the source language will be provided by default.<br>If your requirements does not comply with this behaviour, add a filter with the language id: <em>?filter[langcode][value]=${languageId}`;</em></p><pre>// JSON API request <strong>for</strong> translated stop nodes, with no language fallback.<br>const languageId = &#39;fr&#39;;<br>const nodes = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?filter[langcode][value]=${languageId}`;</pre><h3>JSON API</h3><p>To test JSON API requests, you can use your IDE, Chrome extensions (<a href="https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en">Postman</a>, …), or just use <a href="https://www.mozilla.org/en-US/firefox/developer/">Firefox Developer Edition</a>, it is fast and formats JSON + prints headers out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*AWymQS2Dtf_5Y_hQ.png" /></figure><p>Before we start, here is a discussion about using fetch.</p><h4>Fetch</h4><p>Fetch returns a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>, here are some ways to use it.</p><pre><em>// Chaining with then</em><br><strong>const</strong> data = await fetch(endpoint).then(response =&gt;<br>  response.json(),<br>);</pre><pre><em>// Declare method explicitely and using await, in two steps.</em><br><strong>const</strong> response = await fetch(endpoint, { method: &#39;GET&#39; });<br><strong>const</strong> data = await response.json();</pre><p>We have basically two options to fetch the data from JSON API: on the router action or on the component.</p><h4>1. Fetch on the router</h4><p>A First naive approach, described on the second part of this serie, was to fetch on the router and pass data to the component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bf06d6e8e8559b2426a911188f439f2/href">https://medium.com/media/3bf06d6e8e8559b2426a911188f439f2/href</a></iframe><p>I was basically happy with that, before reading about this performance issue:</p><blockquote>(…) since the routes are universal, it will first run on the server and then run again on the client.<br>This is basically one of the major point of using isomorphic architecture: to prefetch the data on the server.</blockquote><p>See this <a href="https://github.com/kriasoft/react-starter-kit/issues/983#issuecomment-274347315">issue comment</a> on React Starter Kit</p><p>So, it should lead to use Redux by default. You have to define your actions and reducers to couple the stored data to React components.<br>There are loads of good tutorials for that (and <a href="https://medium.com/@stowball/a-dummys-guide-to-redux-and-thunk-in-react-d8904a7005d3">here is one of them</a>), but I didn’t wanted the overhead of adding Redux now.</p><p>It also appears that if you want basic behaviours like error handling for your data, while using the route, you also need Redux or have to work with <em>throw</em> on the router / <em>try — catch</em> on the component.</p><p>Another point was the <em>propTypes</em> definition for each response.</p><p>So I reconsidered fetching on the component itself.</p><h4>2. Fetch on the component</h4><p>Fetching on the component resulted as a simplification, apart while changing a language.<br>The JSON API request was called automatically on language change while getting the data from the route. Now that we are using <em>componentDidMount</em> to fetch, the request is not executed again while using the language switcher.</p><pre>componentDidMount() {<br>  <strong>const</strong> endpoint = ItineraryListPage.getItinerariesEndpoint(<br>    <strong>this</strong>.props.languageId,<br>  );<br>  <strong>this</strong>.fetchItineraries(endpoint);<br>}</pre><p>So we have to add a <em>componentWillReceiveProps</em> definition.</p><pre>componentWillReceiveProps(nextProps) {<br>  <strong>if</strong>(nextPropos.languageId !== <strong>this</strong>.props.languageId) {<br>    <strong>const</strong> endpoint = ItineraryListPage.getItinerariesEndpoint(nextProps.languageId);<br>    <strong>this</strong>.fetchItineraries(endpoint);<br>  }<br>}</pre><p>On the code below, we have simplified the route and added fetch loading state and error handlers. Also, note the usage of propTypes and states that now appears to be much more readable.</p><p>Then, it will still be possible to add progressive enhancement with Redux later on, which looks like a better development approach.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d18feec7571120a5f0306c79ada5979b/href">https://medium.com/media/d18feec7571120a5f0306c79ada5979b/href</a></iframe><h4>Sorting</h4><p>The default sort will not be what you expect in most situations.<br>In some cases, custom sort should be provided instead of alphabetical.<br>This can be easily achieved with the Drupal <a href="https://www.drupal.org/project/weight">Weight</a> module and an extra parameter passed to JSON API: <em>?sort=field_weight</em>.</p><pre><em>// Fetch sorted node stops for this itinerary.</em><br><strong>const</strong> itineraryStopNodesEndpoint = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?sort=field_weight&amp;filter[field_itinerary.uuid][value]=${<strong>this</strong>.props.itineraryId}`;</pre><h4>Filtering examples</h4><p>Filtering by term can be easily done with <em>filter[field_itinerary.uuid][value]=this.props.itineraryId</em></p><p>Here is how to filter nodes with a term: get the stops for an itinerary.</p><pre><em>// Fetch the translated node stops for this itinerary.</em><br><strong>const</strong> itineraryStopNodesEndpoint = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?sort=field_weight&amp;filter[field_itinerary.uuid][value]=${<strong>this</strong>.props.itineraryId}`;</pre><p>And here is the reverse one: stops that are not part of this itinerary.</p><pre><em>// Fetch all the available translated node stops that are not part of the</em><br><em>// current itinerary.</em><br><strong>const</strong> stopNodesEndpoint = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?sort=field_weight&amp;filter[not-current-itinerary][condition][path]=field_itinerary.uuid&amp;filter[not-current-itinerary][condition][operator]=NOT%20IN&amp;filter[not-current-itinerary][condition][value][]=${<strong>this</strong>.props.itineraryId}`;</pre><p>You can continue reading about <a href="https://www.drupal.org/docs/8/modules/json-api/collections-filtering-sorting-and-paginating">filtering, sorting and paginating</a>. For more advanced filtering, have a look at <a href="https://gist.github.com/e0ipso/efcc4e96ca2aed58e32948e4f70c2460">JSON API Fancy Filters</a>.</p><h4>Include images</h4><p>Don’t do this</p><pre>async getImageUrl() {<br>    <strong>const</strong> imageUUID = this.props.itinerary.relationships.field_image.data.id;<br>    <strong>const</strong> fileEndpoint = `${JSON_API_URL}/jsonapi/file/file/${imageUUID}`;<br>    <strong>const</strong> imageResponse = await fetch(fileEndpoint).then(response =&gt;<br>      response.json(),<br>    );<br>    <strong>if</strong> (imageResponse) {<br>      <strong>const</strong> url = `${JSON_API_URL}/${imageResponse.data.attributes.url}`;<br>      this.setState({ imageUrl: url });<br>    }<br>  }</pre><p>But prefer includes</p><pre><strong>const</strong> itineraryStopNodesWithImages = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?filter[field_itinerary.uuid][value]=${<strong>this</strong>.props.itineraryId}&amp;include=field_image`;</pre><h4>Image styles</h4><p>JSON API comes with zero configuration. It means that when you include images, the original image will be provided. You known this 5MB thing that could live on your server.</p><p>This is an exception in the zero configuration rule and it totally makes sense.</p><p>Download and enable the <a href="https://www.drupal.org/project/consumer_image_styles">Consumer Image Styles</a> contrib module on your Drupal site then go to <em>Configuration &gt; Consumers</em> and add a Consumer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/0*Ro01lJAHX52rI9_6.png" /></figure><p>Then you can call your image style with your consumer id.</p><pre><strong>const</strong> itineraryStopNodesWithImageStyles = `${JSON_API_URL}/${languageId}/jsonapi/node/stop?_consumer_id=${CONSUMER_ID}&amp;sort=field_weight&amp;filter[field_itinerary.uuid][value]=${<strong>this</strong>.props.itineraryId}&amp;include=field_image`;</pre><p>The image styles will then be available in the meta.derivatives:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*HvF8Ar1Kt-MJaJbq.png" /></figure><p>For more information about image styles, read <a href="https://www.lullabot.com/articles/decoupled-drupal-hard-problems-image-styles">this article from Lullabot</a>.</p><h4>Getting parent terms only</h4><p>Let’s say that we have the following structure on our content model.</p><ul><li>Itineraries can have or not child itineraries, we use the terms relation (hierarchy) for that.<br><em>Example: The “Adult” itinerary has the “Film Noir” and “Zombie films” sub itineraries. The “Child” itinerary have no child itineraries.</em></li><li>A stop can belong to several itineraries, so the term reference has a Drupal multiplicity of ‘unlimited’.<br><em>Example: “The Maltese Falcon” belongs to the “Adult” and “Film Noir”</em></li></ul><p>Based on that, we want to display the parent itinerary terms on a first view.</p><p>Depending on your Drupal version, the parents may be empty in you JSON API response, see <a href="https://www.drupal.org/project/jsonapi/issues/2775635">Parent is always empty for taxonomy terms</a>and <a href="https://www.drupal.org/node/2543726">Make $term-&gt;parent behave like any other entity reference field, to fix REST support and de-customize its Views integration</a></p><p>This is far from ideal (for redundancy), but as a temporary workaround, a <em>is parent</em> boolean can be added to the<em> Itinerary</em> vocabulary.<br>So the request for itineraries is now using <em>filter[field_is_parent][value]=1 </em>(note the 1 as true).</p><pre>${JSON_API_URL}/${languageId}/jsonapi/taxonomy_term/itinerary?filter[field_is_parent][value]=1&amp;sort=weight&amp;include=field_image</pre><h4>Displaying optional child itineraries with propTypes and defaultProps</h4><p>On a second view, e.g. while getting stops for an itinerary, we may want to group the stops by child itineraries.<br>In our content model, an itinerary can have a relation of 0..* for child itineraries. So we need tell React that they are optional and that JSON API will not always return values for the childItineraries prop.</p><p><em>defaultProps</em> are there for that purpose.</p><pre>static propTypes = {<br>    childItineraries: PropTypes.shape({<br>      data: PropTypes.arrayOf(<br>        PropTypes.shape({<br>          id: PropTypes.string.isRequired,<br>        }).isRequired,<br>      ).isRequired,<br>      included: PropTypes.arrayOf(<br>        PropTypes.shape({<br>          id: PropTypes.string.isRequired,<br>        }).isRequired,<br>      ).isRequired,<br>    }),<br>  };</pre><pre>  static defaultProps = {<br>    childItineraries: null,<br>  };</pre><p>Read more on <a href="https://reactjs.org/docs/typechecking-with-proptypes.html">Typechecking With PropTypes</a> from the official React documentation.</p><h3>Deploy in production</h3><p>If you are using the same production server that hosts your Drupal site to serve your web app, you will have to run it on the same port (80 or 443) as Apache or Nginx.</p><p>We will use Apache here, as a reverse proxy.</p><h4>1. Install and test Node.js</h4><p>Install the NodeSource PPA</p><pre>cd ~<br>curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh<br>sudo bash nodesource_setup.sh</pre><p>Install node, npm and build-essential</p><pre>sudo apt-get install nodejs<br>sudo apt-get install build-essential</pre><h4>Test node from the same server</h4><pre>nano hello.js</pre><pre>#!/usr/bin/env nodejs<br><strong>var</strong> http = require(&#39;http&#39;);<br>http.createServer(<strong>function</strong> (req, res) {<br>  res.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});<br>  res.end(&#39;Hello World\n&#39;);<br>}).listen(8080, &#39;localhost&#39;);<br>console.log(&#39;Server running at <a href="http://localhost:8080/&#39;);">http://localhost:8080/&#39;);</a></pre><pre>chmod +x ./hello.js<br>./hello.js</pre><pre>curl <a href="http://localhost:8080/">http:</a><a href="http://localhost:8080/"><em>//localhost:8080</em></a></pre><p>The result of the curl command should be the message from your console.log.</p><h4>Test form another server</h4><p>If you want to test your app from the outside, just remind to open your port (here 8080).</p><pre>iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT</pre><p>Read more about <a href="https://help.ubuntu.com/community/IptablesHowTo">Iptables</a>.</p><p>Also, in this case, let your node server listen to 0.0.0.0 and not localhost, as described in <a href="https://serverfault.com/questions/271824/node-js-is-not-accessible-from-external-ips-on-ubuntu">this issue</a>.</p><pre><strong>var</strong> http = require(&#39;http&#39;); <br>http.createServer(<strong>function</strong> (req, res) { <br>  res.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});<br>  res.end(&#39;Hello World\n&#39;);<br> }<br>).listen(8080, &quot;0.0.0.0&quot;); <br>console.log(&#39;Server running at <a href="http://0.0.0.0:8080/&#39;);">http://0.0.0.0:8080/&#39;);</a></pre><h4>2. Install Yarn</h4><pre>curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -<br>echo &quot;deb https://dl.yarnpkg.com/debian/ stable main&quot; | sudo tee /etc/apt/sources.list.d/yarn.list<br>sudo apt-get update &amp;&amp; sudo apt-get install yarn</pre><h4>3. Prepare your virtualhost</h4><ul><li>Clone your repository, to keep things organized I put it on the user directory that is dedicated to the virtualhost.</li><li>Cd into the cloned repo directory then install dependencies with yarn install</li><li>Production build with yarn run build --release</li></ul><p>Another option is to use a deployment script, so we do not need yarn in production.</p><h4>4. Manage your application with PM2</h4><p><a href="http://pm2.keymetrics.io/">PM2</a> is a production process manager for Node.js. We will use it to run our React application.<br>Install it globally and make it available on startup.</p><pre>sudo npm install -g pm2<br>pm2 startup systemd</pre><p>Then start your application and check the status.</p><pre>pm2 start build/server.js<br>pm2 status</pre><p>If you need to restart it, after a rebuild.</p><pre>pm2 restart build/server.js</pre><h4>5. Configure Apache</h4><p>Modify your Apache vhost configuration as a reverse proxy to the port used by your application (here 3000).<br>Do the same for the port 443 (https).</p><pre>&lt;VirtualHost *:80&gt;<br><strong>ServerName</strong> mysite.org<br><strong>ServerAlias</strong> www.mysite.org<br><strong>DocumentRoot</strong> /home/mysite/docroot</pre><pre>&lt;Proxy *&gt;<br>  <strong>Order</strong> deny,allow<br>  <strong>Allow</strong> from all<br>&lt;/Proxy&gt;</pre><pre><strong>ProxyPreserveHost</strong> On<br><strong>ProxyRequests</strong> off<br><strong>ProxyPass</strong> / http://mysite.org:3000/<br><strong>ProxyPassReverse</strong> / mysite.org:3000/<br>&lt;/VirtualHost&gt;</pre><p>Enable the Apache proxy modules and reload Apache.</p><pre>sudo a2enmod proxy<br>sudo a2enmod proxy_http<br>service apache2 reload</pre><p>Your app should now be available, yay!</p><h3>Resources</h3><ul><li><a href="https://github.com/kriasoft/react-starter-kit/blob/feature/redux/docs/recipes/how-to-integrate-redux.md">React Starter Kit Redux documentation</a></li><li><a href="https://github.com/kriasoft/react-starter-kit/wiki/Extremely-detailed-guide-to-how-react-starter-kit-is-wired-and-works,-from-beginning-to-end">Detailed guide about React Starter Kit</a></li><li>Lullabot <a href="https://www.lullabot.com/articles/decoupled-drupal-hard-problems-image-styles">Decoupled Drupal Hard Problems: Image Styles</a></li><li>Amazee Labs <a href="https://www.amazeelabs.com/en/blog/dont-push-it-using-graphql-twig">Don’t Push it: Using GraphQL in Twig</a>, could be an alternative to decoupling</li><li>Dropsolid <a href="https://dropsolid.com/en/blog/drupal-8-and-react-native">Drupal 8 and React Native</a></li><li>Smashing Magazine <a href="https://www.smashingmagazine.com/2017/06/transition-hybrid-apps-react-native/">Hybrid Apps And React Native: A Time To Transition?</a></li><li>Digital Ocean <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04">How To Set Up a Node.js Application for Production on Ubuntu 16.04</a></li></ul><h3>Related articles</h3><ul><li><a href="https://colorfield.be/blog/react-and-drupal-8-json-api-2">React and Drupal 8 with JSON API 2/3</a></li><li><a href="https://colorfield.be/blog/react-and-drupal-8-json-api-1">React and Drupal 8 with JSON API 1/3</a></li><li><a href="https://colorfield.be/blog/drupal-8-react-vue-json-api-and-es6-learning-resources">Drupal 8, React, Vue, JSON API and ES6 learning resources</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b70120ac8274" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install an existing Laravel project]]></title>
            <link>https://medium.com/@colorfield/install-an-existing-laravel-project-c6e6bf28d5c6?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6e6bf28d5c6</guid>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Thu, 06 Jul 2017 08:27:52 GMT</pubDate>
            <atom:updated>2017-07-06T08:27:52.583Z</atom:updated>
            <content:encoded><![CDATA[<p>Originally posted on <a href="https://colorfield.be/blog/install-existing-laravel-project">colorfield.be</a></p><p>A quick todo list for setting up a freshly cloned project.</p><p>Install the dependencies with Composer.</p><pre><em># cd in your project directory</em><br>composer install<br>composer dumpautoload -o</pre><p>Check if the values in config/app.php meets your needs, depending where (staging, dev, …) and how (php -S, artisan, vm with a domain, …) you are running it.</p><pre><em># Environment</em><br>&#39;env&#39; =&gt; env(&#39;APP_ENV&#39;, &#39;production&#39;),<br><em># Debug mode</em><br>&#39;debug&#39; =&gt; env(&#39;APP_DEBUG&#39;, <strong>false</strong>),<br><em># URL</em><br>&#39;url&#39; =&gt; env(&#39;APP_URL&#39;, &#39;http://localhost&#39;),</pre><p>Define your environment file, at the root of your project directory.</p><pre><em># Copy the environment template</em><br>cp .env.example .env</pre><p>Generate the key for your environment file, it will define the value for ‘APP_KEY=’</p><pre>php artisan key:generate</pre><p>Edit then the .env file to suit your needs (APP_*, DB_*, …).</p><p>Finish by clearing the config and generate the cache.</p><pre>php artisan config:clear<br>php artisan config:cache</pre><p>Time to check your site, depending on your environment, for development, the easiest way is to use Artisan.</p><pre>php artisan serve</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6e6bf28d5c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating SQL in Drupal 8 with Migrate Tools and Migrate Plus]]></title>
            <link>https://medium.com/@colorfield/migrating-sql-in-drupal-8-with-migrate-tools-and-migrate-plus-784dc91897e?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/784dc91897e</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[etl]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Thu, 15 Jun 2017 11:49:31 GMT</pubDate>
            <atom:updated>2017-10-24T17:33:12.390Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://colorfield.be/blog/migrating-sql-in-drupal-8-with-migrate-tools-and-migrate-plus">Originally posted on colorfield.be</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*3wxllwxQEoqd6S0oU39EgA.jpeg" /></figure><p><em>UPDATE FOR DRUPAL 8.4<br>We must wait for </em><a href="https://www.drupal.org/node/2914005"><em>this issue</em></a><em> to be fixed to use Migrate Tools with Drush 9 (that is used by default by 8.4).<br>If you still use Drush 8 in global (and not from your local vendor/bin) read </em><a href="https://www.drupal.org/node/2825846"><em>this issue</em></a><em>.</em></p><p>Migrate API is awesome, and if you plan some custom migration, a few contributed modules does the heavy lifting for you.</p><p>This article should be regarded as a list of steps to follow to achieve a simple migration from another SQL data source than Drupal. So we will not go in deep into the explanations of the Migrate theory, for this subject, refer to the documentation of the <a href="https://www.drupal.org/node/2127611">Migrate API</a>.<br>Also, we will finish with some debugging techniques and a first shot of a bash script for rerolling a migration from scratch in case of configuration change.</p><p>Here is <a href="https://github.com/r-daneelolivaw/my_custom_migrate">a repository</a> with the code exposed below.</p><p>You can also find a kickstarter article for <a href="https://colorfield.be/blog/drupal-8-json-custom-migration">JSON custom migration</a>.</p><h3>SQL to Drupal fields</h3><p>Here is a simple case :</p><ul><li>We want to migrate rows from a company table into nodes from a Company content type.</li><li>Here is the mapping for the table columns into the <em>Drupal node fields</em>, test data are provided below, in point 4.</li><li><strong>name</strong> (varchar) -&gt; node <em>title</em></li><li><strong>description</strong> (text) -&gt; <em>body,</em> default node text field</li><li><strong>phone</strong> (varchar) -&gt; <em>telephone</em> field</li><li><strong>email</strong> (varchar) -&gt; <em>email</em> field</li><li><strong>website</strong> URL (varchar) -&gt; <em>link</em> field</li><li><strong>id</strong> (int) -&gt; no field, kept for source — destination mapping</li></ul><p>We also want simple processing like trim for telephone numbers and validate for email addresses.</p><p>Note that the id will be used by the Migrate system to keep a mapping of the source id / destination entity id, for update and status purposes, in the <em>migrate_map_company</em> Drupal table that is created by the Migrate system.</p><p>For other concepts like entity reference, great code examples are available in the migrate_plus module, that comes with two submodules.</p><ul><li><em>migrate_example</em></li><li><em>migrate_example_advanced</em></li></ul><p>If you are still interested by covering entity reference and other Migrate concepts in another article, just drop a word.</p><p>At this point it is still good to know that</p><ul><li>the <a href="https://www.drupal.org/node/2149801">migration_lookup process plugin</a> that takes care of references</li><li>you can implement <a href="https://www.drupal.org/node/1132582">several methods</a> [prepareRow, prepare, complete, createStub] to e.g. modify or skip rows.</li></ul><h3>1. Create a new Drupal project</h3><p>A good starting point is the <a href="https://github.com/drupal-composer/drupal-project">Composer template for Drupal projects</a>.</p><h3>2. Add dependencies</h3><p>Get the <a href="https://www.drupal.org/project/migrate_tools">Migrate Tools</a> and <a href="https://www.drupal.org/project/migrate_plus">Migrate Plus</a> modules.</p><pre><em># migrate_tools requires migrate_plus</em><br>composer require drupal/migrate_tools</pre><h3>3. Scaffold a module with Drupal Console</h3><pre><em># Via the Composer template for Drupal project, preferably use the tools provided under the /vendor/bin directory (drupal console, drush, phpcs, ...) and not the globally installed.</em><br>./vendor/bin/drupal gm</pre><pre> // Welcome to the Drupal module generator</pre><pre> Enter the new module name:<br> &gt; My Custom Migrate</pre><pre> Enter the module machine name [my_custom_migrate]:<br> &gt; </pre><pre> Enter the module Path [/modules/custom]:<br> &gt; </pre><pre> Enter module description [My Awesome Module]:<br> &gt; Custom migrate example</pre><pre> Enter package name [Custom]:<br> &gt; Migration</pre><pre> Enter Drupal Core version [8.x]:<br> &gt; </pre><pre> Do you want to generate a .module file (yes/no) [yes]:<br> &gt; </pre><pre> Define module as feature (yes/no) [no]:<br> &gt; </pre><pre> Do you want to add a composer.json file to your module (yes/no) [yes]:<br> &gt; no</pre><pre> Would you like to add module dependencies (yes/no) [no]:<br> &gt; yes</pre><pre> Module dependencies separated by commas (i.e. context, panels):<br> &gt; migrate_tools</pre><pre> Do you want to generate a unit test class (yes/no) [yes]:<br> &gt; no</pre><pre> Do you want to generate a themeable template (yes/no) [yes]:<br> &gt; no<br></pre><pre> Do you confirm generation? (yes/no) [yes]:<br> &gt; yes</pre><pre>Generated or updated files</pre><pre> 1 - /var/www/dev/drupal8/web/modules/custom/my_custom_migrate/my_custom_migrate.info.yml<br> 2 - /var/www/dev/drupal8/web/modules/custom/my_custom_migrate/my_custom_migrate.module</pre><h3>4. Reference your source database</h3><p>Here we go!<br>Modify the <em>sites/default/settings.php</em> file and append the reference to the source database. Copy this at the bottom of the file, right after the $databases[‘default’][‘default’] = array (…);</p><pre><em>// Use the &#39;migrate&#39; key.</em><br>$databases[&#39;migrate&#39;][&#39;default&#39;] = <strong>array</strong> (<br>  <em>// Replace by your source database name and credentials</em><br>  &#39;database&#39; =&gt; &#39;my_source_database&#39;,<br>  &#39;username&#39; =&gt; &#39;root&#39;,<br>  &#39;password&#39; =&gt; &#39;root&#39;,<br>  &#39;prefix&#39; =&gt; &#39;&#39;,<br>  &#39;host&#39; =&gt; &#39;localhost&#39;,<br>  &#39;port&#39; =&gt; &#39;3306&#39;,<br>  &#39;namespace&#39; =&gt; &#39;Drupal\\Core\\Database\\Driver\\mysql&#39;,<br>  &#39;driver&#39; =&gt; &#39;mysql&#39;,<br>);</pre><p>Here is a SQL sample that creates the Company table and populates 100 records</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b65c22742a8f77a55ab019c99405ea0d/href">https://medium.com/media/b65c22742a8f77a55ab019c99405ea0d/href</a></iframe><h3>5. Create your content type and fields</h3><p>Create a Company content type and make sure that it contains the following fields.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*lm9YTLWf2q0Oq6PP.png" /></figure><h3>6. Plugins for the Extract — Transform — Load phases (ETL)</h3><p>Only the Source plugin definition is required, Process (e.g. case transform) and Destination plugins are here to help on customizing the migration to your needs.</p><p>The Process comes with a default one-to-one field migration (the get Plugin).<br>Here is the full list of all the <a href="https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins">core Process plugins available</a>, like concat, explode, flatten, default_value and much more.</p><p>Destination plugins also have core definition like entity:node. Here you can also define your custom entity types, but this is not covered by this article.</p><p>So we have</p><ul><li>Extract : <strong>Source</strong> plugin</li><li>Transform : <strong>Process</strong> plugin</li><li>Load : <strong>Destination</strong> plugin</li></ul><p>In my_custom_migrate module, create the following directory structure</p><ul><li>src/Plugin/migrate/source</li><li>src/Plugin/migrate/process</li></ul><h3>Source plugin</h3><p>Add the <em>Company.php</em> file in the <em>src/Plugin/migrate/source directory</em> where you will create the source fields definition.</p><pre><strong>&lt;?php</strong></pre><pre><em>/**<br> * @file<br> * Contains Drupal\my_custom_migrate\Plugin\migrate\source\Company<br> */</em></pre><pre><strong>namespace</strong> <strong>Drupal</strong>\<strong>my_custom_migrate</strong>\<strong>Plugin</strong>\<strong>migrate</strong>\<strong>source</strong>;</pre><pre><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>Plugin</strong>\<strong>migrate</strong>\<strong>source</strong>\<strong>SqlBase</strong>;</pre><pre><em>/**<br> * Source plugin for Companies.<br> *<br> * @MigrateSource(<br> *   id = &quot;company&quot;<br> * )<br> */</em><br><strong>class</strong> <strong>Company</strong> <strong>extends</strong> <strong>SqlBase</strong> {</pre><pre>  <em>/**<br>   * {@inheritdoc}<br>   */</em><br>  <strong>public</strong> <strong>function</strong> <strong>query</strong>() {<br>    $query = $this-&gt;select(&#39;company&#39;, &#39;c&#39;)<br>      -&gt;fields(&#39;c&#39;, <strong>array</strong>(<br>        &#39;id&#39;,<br>        &#39;name&#39;,<br>        &#39;description&#39;,<br>        &#39;phone&#39;,<br>        &#39;email&#39;,<br>        &#39;website&#39;,<br>      ));<br>    <strong>return</strong> $query;<br>  }</pre><pre>  <em>/**<br>   * {@inheritdoc}<br>   */</em><br>  <strong>public</strong> <strong>function</strong> <strong>fields</strong>() {<br>    $fields = <strong>array</strong>(<br>      &#39;id&#39; =&gt; $this-&gt;t(&#39;Autoincrement ID&#39;),<br>      &#39;name&#39; =&gt; $this-&gt;t(&#39;Company name&#39;),<br>      &#39;description&#39; =&gt; $this-&gt;t(&#39;HTML content&#39;),<br>      &#39;phone&#39; =&gt; $this-&gt;t(&#39;Telephone number&#39;),<br>      &#39;email&#39; =&gt; $this-&gt;t(&#39;Email address&#39;),<br>      &#39;website&#39; =&gt; $this-&gt;t(&#39;Website URL&#39;),<br>    );<br>    <strong>return</strong> $fields;<br>  }</pre><pre>  <em>/**<br>   * {@inheritdoc}<br>   */</em><br>  <strong>public</strong> <strong>function</strong> <strong>getIds</strong>() {<br>    <strong>return</strong> [<br>      &#39;id&#39; =&gt; [<br>        &#39;type&#39; =&gt; &#39;integer&#39;,<br>        &#39;alias&#39; =&gt; &#39;c&#39;,<br>      ],<br>    ];<br>  }<br>}</pre><h3>Process plugins</h3><p>We will cover here 2 Process plugins : Trim and ValidateMail.</p><h4>Trim</h4><p>Some modules are removing whitespace (like Email), some not (like Telephone) while storing their values.<br>Migration is a good moment to clean up.</p><p>Note that for such a trivial task we should use the <a href="https://www.drupal.org/docs/8/api/migrate-api/migrate-process/process-plugin-callback">callback process plugin</a> with the trim php function.<br>This plugin example is only here to expose both ways to achieve it.</p><p>Example with the <em>callback</em>, in the Migrate Plus yml file (see more in point <em>7. Define the Migrate Plus yml file</em>).</p><pre>process:<br>  destination_field:<br>    plugin: callback<br>    callable: trim<br>    source: source_field</pre><p>Example with the <em>Process plugin</em></p><pre><strong>&lt;?php</strong></pre><pre><em>/**<br> * @file<br> * Contains Drupal\my_custom_migrate\Plugin\migrate\process\Trim<br> */</em></pre><pre><strong>namespace</strong> <strong>Drupal</strong>\<strong>my_custom_migrate</strong>\<strong>Plugin</strong>\<strong>migrate</strong>\<strong>process</strong>;</pre><pre><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>ProcessPluginBase</strong>;<br><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>MigrateException</strong>;<br><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>MigrateExecutableInterface</strong>;<br><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>Row</strong>;</pre><pre><em>/**<br> * Removes the first and last whitespaces.<br> * For demo purpose only, for such a trivial task use the callback process plugin :<br> * https://www.drupal.org/docs/8/api/migrate-api/migrate-process/process-plugin-callback<br> *<br> * @MigrateProcessPlugin(<br> *   id = &quot;trim&quot;<br> * )<br> */</em><br><strong>class</strong> <strong>Trim</strong> <strong>extends</strong> <strong>ProcessPluginBase</strong> {</pre><pre>  <em>/**<br>   * {@inheritdoc}<br>   */</em><br>  <strong>public</strong> <strong>function</strong> <strong>transform</strong>($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {<br>    <strong>if</strong> (is_string($value)) {<br>      <strong>return</strong> trim($value);<br>    }<br>    <strong>else</strong> {<br>      <strong>throw</strong> <strong>new</strong> MigrateException(sprintf(&#39;%s is not a string&#39;, var_export($value, <strong>TRUE</strong>)));<br>    }<br>  }<br>}</pre><h4>ValidateMail</h4><p>Nothing really different here, apart from the MigrateException that we do not want to throw : let’s say that the email field in the content type is not mandatory, we do not want the row to be skipped for an invalid email.<br>So let’s import the row, but do not populate the field with a wrong email address, just an empty string. Ideally, we should add some code to log this for later manual processing.</p><pre><strong>&lt;?php</strong></pre><pre><em>/**<br> * @file<br> * Contains Drupal\my_custom_migrate\Plugin\migrate\process\ValidateMail<br> */</em></pre><pre><strong>namespace</strong> <strong>Drupal</strong>\<strong>my_custom_migrate</strong>\<strong>Plugin</strong>\<strong>migrate</strong>\<strong>process</strong>;</pre><pre><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>ProcessPluginBase</strong>;<br><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>MigrateExecutableInterface</strong>;<br><strong>use</strong> <strong>Drupal</strong>\<strong>migrate</strong>\<strong>Row</strong>;</pre><pre><em>/**<br> * Checks if the mail syntax is correct.<br> *<br> * @MigrateProcessPlugin(<br> *   id = &quot;validate_mail&quot;<br> * )<br> */</em><br><strong>class</strong> <strong>ValidateMail</strong> <strong>extends</strong> <strong>ProcessPluginBase</strong> {</pre><pre>  <em>/**<br>   * {@inheritdoc}<br>   */</em><br>  <strong>public</strong> <strong>function</strong> <strong>transform</strong>($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {<br>    $value = trim($value);<br>    <strong>if</strong> (\Drupal::service(&#39;email.validator&#39;)-&gt;isValid($value)) {<br>      <strong>return</strong> $value;<br>    }<br>    <strong>else</strong> {<br>      <em>// throw new MigrateException(sprintf(&#39;%s is not a mail&#39;, var_export($value, TRUE)));</em><br>      <em>// do not throw Exception, just an empty value so our row is still imported.</em><br>      <strong>return</strong> &#39;&#39;;<br>    }<br>  }<br>}</pre><h3>7. Define the Migrate Plus yml file</h3><p>Create the <em>my_custom_migrate/config/install/migrate_plus.migration.company.yml </em>that defines the migration “metadata” (id and group that will be used by the drush commands) and references the source, process and destination plugins.</p><pre><em># Migration metadata</em><br>id: company<br>label: Migrate list of companies<br>migration_group: my_custom_migrate</pre><pre><em># Source plugin, id defined in the @MigrateSource annotation</em><br><em># in the src/Plugin/migrate/source/Company.php file.</em><br>source:<br>  plugin: company</pre><pre><em># Destination plugin</em><br>destination:<br>  plugin: entity:node</pre><pre><em># Process plugin</em><br>process:<br>  <em># Node type (bundle)</em><br>  type:<br>    plugin: default_value<br>    default_value: company</pre><pre>  <em># One-to-one field mapping using the default &quot;get&quot; process plugin.</em><br>  title: name<br>  <em># We can also use body/summary, body/format</em><br>  <em># see core/modules/text/config/schema/text.schema.yml</em><br>  <em># field.value.text_with_summary, used by the node entity for the body field.</em><br>  body/value: description<br>  field_telephone:<br>    plugin: trim<br>    source: phone<br>  field_email:<br>    plugin: validate_mail<br>    source: email<br>  field_website: website <em># and not field_website/url</em></pre><pre><em># Nothing needed here, it is a single table without any other relation.</em><br>migration_dependencies: {}</pre><h3>8. Enable your module</h3><pre>drush en my_custom_migrate -y</pre><h3>9. Execute migration</h3><p>Before we start, check the status of the migration.</p><pre><em># Shorthand for drush migrate-status</em><br>drush ms</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/0*aV2d_ZtnPaPs9hiD.png" /></figure><p>Then import the migration group.</p><pre><em># Shorthand for drush migrate-import</em><br>drush mi company<br><em># Note that in this case, this is similar to drush mi --group=my_custom_migrate, because company is the only item in the group</em></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*jSxVr4OHchAVO2mS.png" /></figure><p>You can also rollback your migration</p><pre><em># Shorthand for drush migrate-rollback, separate with commas if multiple: drush mr company,contact</em><br>drush mr company</pre><p><a href="https://www.drupal.org/node/1561820">Other Drush Migrate commands</a></p><h3>10. Debugging techniques</h3><p>Nice tips from Mike Ryan found on StackOverflow:</p><blockquote>I usually run migrations in drush and, when not stepping through in a debugger, use drush_print_r(). The key points you want to instrument are prepareRow() (dump $row to make sure the source data is being pulled correctly in the first place) and prepare() (dump $node to make sure the source values are getting properly mapped into the node object that’s about to be saved).</blockquote><h4>Source Plugin</h4><p>Edit the <em>Company.php</em> Source plugin and implement the prepareRow method to dump the rows and check if the source data is being pulled correctly.</p><pre><strong>public</strong> <strong>function</strong> <strong>prepareRow</strong>(Row $row) {<br>    drush_print_r($row);<br>    <strong>return</strong> <strong>parent</strong>::prepareRow($row);<br>  }</pre><p>You can also limit the rows to be imported on the query method, by adding a range. This will also be reflected with drush ms that uses this query to display the amount of items to be imported.</p><pre><strong>public</strong> <strong>function</strong> <strong>query</strong>() {<br>    $query = $this-&gt;select(&#39;company&#39;, &#39;c&#39;)<br>      -&gt;fields(&#39;c&#39;, <strong>array</strong>(<br>        &#39;id&#39;,<br>        &#39;name&#39;,<br>        &#39;description&#39;,<br>        &#39;phone&#39;,<br>        &#39;email&#39;,<br>        &#39;website&#39;,<br>      ))-&gt;range(0,10);<br>    <strong>return</strong> $query;<br>}</pre><h4>Migrate Plus yml configuration</h4><p>If you change the config/install configuration yml file(s), you will need to reinstall or use the <a href="https://www.drupal.org/project/config_devel">Configuration development</a> contributed module.</p><p>If you choose the first option, you can use what follows.</p><p>Implement the hook_uninstall() on a <em>my_custom_migrate.install</em> file.</p><pre><strong>&lt;?php</strong></pre><pre><em>/**<br> * Implements hook_uninstall().<br> */</em><br><strong>function</strong> <strong>my_custom_migrate_uninstall</strong>() {<br>  <em>// @review with like</em><br>  $configs  = [<br>    &#39;migrate_plus.migration_group.my_custom_migrate&#39;,<br>    &#39;migrate_plus.migration.company&#39;,<br>  ];<br>  <strong>foreach</strong>($configs <strong>as</strong> $config) {<br>    $delete = \Drupal::database()-&gt;delete(&#39;config&#39;)<br>      -&gt;condition(&#39;name&#39;, $config)<br>      -&gt;execute();<br>  }<br>  drupal_flush_all_caches();<br>}</pre><p>With the devel module installed run this to uninstall and reinstall your module.</p><pre>drush dre my_custom_migrate -y</pre><p>Then remove all the content (with devel generate installed).</p><pre>drush genc 0 --kill --types=company</pre><p>Here is a draft of bash script to launch this reroll</p><pre><strong>#!/bin/bash</strong></pre><pre><em># Prompt for confirmation</em><br>read -p &quot;This will reinstall the custom migrate module, delete all the entities from the content type and restart import. Are you sure (y/n)? &quot; -n 1 -r<br><em># Move to a new line</em><br>echo<br><strong>if</strong> [[ $REPLY =~ ^[Yy]$ ]]<br><strong>then</strong><br>    SECONDS=0<br>    echo &quot;Getting initial status...&quot;<br>    <em># Status</em><br>    drush ms<br>    echo &quot;Reinstalling the custom migrate module...&quot;<br>    <em># Assumes that devel installed</em><br>    drush dre my_custom_migrate -y<br>    echo &quot;Removing all the nodes...&quot;<br>    <em># Delete all the content, assumes that devel generate is installed</em><br>    drush genc 0 --kill --types=company<br>    echo &quot;Status...&quot;<br>    <em># Status</em><br>    drush ms<br>    echo &quot;Reimport...&quot;<br>    <em># Import</em><br>    drush mi --group=my_custom_migrate<br>    echo &quot;$SECONDS seconds elapsed.&quot;<br><strong>fi</strong></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*r5CyFqCejNBpNYoS.jpg" /></figure><h3>Resources</h3><ul><li>Drupal.org <a href="https://www.drupal.org/node/1561820">Drush Migrate commands</a></li><li>Lullabot <a href="https://www.lullabot.com/articles/pull-content-from-a-remote-drupal-8-site-using-migrate-and-json-api">Pull Content From a Remote Drupal 8 Site Using Migrate and JSON API</a></li><li>Palantir <a href="https://www.palantir.net/blog/migrating-xml-drupal-8">Migrating XML in Drupal 8</a></li><li>Evolvingweb <a href="https://evolvingweb.ca/fr/blog/migrate-translations-csv-json-or-xml-drupal-8">Migrate Translations from CSV, JSON or XML to Drupal 8</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=784dc91897e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React and Drupal 8 with JSON API 2/3]]></title>
            <link>https://medium.com/@colorfield/react-and-drupal-8-with-json-api-2-3-e95298d24ade?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e95298d24ade</guid>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[drupal-development]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Wed, 31 May 2017 17:47:40 GMT</pubDate>
            <atom:updated>2017-05-31T17:47:40.178Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://colorfield.be/blog/react-and-drupal-8-json-api-2">Originally posted on colorfield.be</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*HXTnqrvzkcFFNKnuzAP2TA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*9ckranQupMoivqv6." /></figure><p>The <a href="https://colorfield.be/blog/react-and-drupal-8-json-api-1">first post</a> of this serie focused on setting up easily a multilingual Drupal and React environment for a museum Audioguide web app.</p><p>This one describes the steps to achieve a <a href="https://en.wikipedia.org/wiki/Minimum_viable_product">MVP</a> that displays a list and a detail page of Audio contents, so we have the opportunity to cover several basic concepts under React :</p><ul><li><strong>Components</strong> : add from a package repository, inherit, compose, create</li><li><strong>Routes</strong> : default route and wildcard</li><li><strong>Fetch</strong> to consume Rest</li><li><strong>Localization</strong> via React Intl</li></ul><p>French and English are being used to cover the translation feature in this demo.</p><h3>Part 1 : The Drupal backend</h3><h3>Prepare the content</h3><p>On the previous post, we prepared a basic Drupal environment to test the <a href="https://www.drupal.org/project/jsonapi">JSON API</a> module with the default <em>Article</em> content type.<br>We now want a translatable <em>Audio</em> content type with some extra fields.</p><h4>Option 1 : create a new Drupal setup</h4><p>If you just start from this post, here is a repo that provides what is needed for the <a href="https://github.com/r-daneelolivaw/audioguide-demo-drupal">Audioguide backend</a>. It will avoid manual operations like the content type and language configuration and comes with some demo content.</p><pre>git clone https://github.com/r-daneelolivaw/audioguide-demo-drupal<br><em># cd in the cloned repository and install dependencies</em><br>composer install</pre><p>Then head to the Drupal installation and select the Configuration installer profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*noq2AgoRsrDWmnJP.png" /></figure><p>Let the default ../config/sync directory</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*FSaY8kK9_Erek0q6.png" /></figure><p>After completing installation, do not pay attention to the warning messages about missing languages inviting you to define a least another one, French is well installed. There is a patch being created to address an issue while sh<a href="https://www.drupal.org/node/2413191">ipping a profile with multiple languages a</a>nd the drupal-2413191–21.patch was already applied during composer install.</p><p>Once installed, you can populate the default demo content via this URL <strong>/admin/content/demo</strong>.<br><em>Please note that the nodes translation are not related to each other and the MP3 files are not translated, but the demo content will provide 2 nodes in French and 2 in English, which is sufficient for our demo purpose.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*87K2S_5GFX7UH_bN.png" /></figure><h4>Option 2 : continue from the previous setup</h4><p>In the first part of the tutorial, we created 20 dummy Articles, first get rid of them.</p><pre><em># Assuming that you have devel generate enabled, see part 1</em><br>drush genc 0 --kill --types=article</pre><p>Enable the <strong>Language</strong> and <strong>Content Translation</strong> module.</p><pre>drush en language content_translation -y</pre><p>Add the French language on <strong>/admin/config/regional/language</strong></p><p>Then you can create the Audio content type and make it translatable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*Cz9nsFk7TDptxqPl.png" /></figure><p>Define the following fields, and to keep it simple, all marked as required :</p><ul><li><strong>Title</strong> (default) — translatable by default when defining the content type as translatable.</li><li><strong>Body</strong> (default) — translatable by checking the “Users may translate this field”</li><li><strong>Id</strong> (field_id, integer) — not translatable</li><li><strong>MP3</strong> (field_mp3, file that allows mp3) — not translatable in this demo, but this will not affect the React code.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*OrlmgjEn6P7kuOaiDJBsBg.png" /></figure><p>Then devel generate content for both languages on <strong>/admin/config/development/generate/</strong>content and provide mp3 files.</p><h4>Test the JSON API output</h4><p>If everything went ok, you should now have a different JSON output per language.</p><p><strong>/jsonapi/node/audio?filter[langcode][value]=fr<br>/jsonapi/node/audio?filter[langcode][value]=en</strong></p><p>Drupal.org JSON API documentation about <a href="https://www.drupal.org/docs/8/modules/json-api/collections-filtering-sorting-and-paginating">filtering, sorting and paginating</a>.</p><h3>Part 2 : The React frontend</h3><p>A repository is also available for the React web app. What is described below lives in the <a href="https://github.com/r-daneelolivaw/audioguide-demo-react/tree/01-mvp">01-mvp branch</a>.</p><h3>Language setup for l10n (localization)</h3><p>The following changes will define French as a translation language, instead of the default Czech configuration that comes with the React Intl branch of the React Starter Kit.</p><h4>Change the default locales</h4><p>Edit <strong>/src/config.js</strong> and change the default language by Canadian French or <a href="https://tools.ietf.org/html/bcp47">anything else</a>, just make sure that it matches your Drupal configuration.</p><pre><em>// change</em><br>locales: [&#39;en-US&#39;, &#39;cs-CZ&#39;] <br><em>// to </em><br>locales: [&#39;en-US&#39;, &#39;fr-CA&#39;]</pre><p>Edit /src/client.js and again, change the default</p><pre><em>// change</em><br>import cs from &#39;react-intl/locale-data/cs&#39;;<br>(...)<br>[en, cs].forEach(addLocaleData);</pre><pre><em>// to</em><br>import fr from &#39;react-intl/locale-data/fr&#39;;<br>(...)<br>[en, fr].forEach(addLocaleData);</pre><h4>Change the LanguageSwitcher language name</h4><p>Edit the LanguageSwitcher component in <strong>/src/components/LanguageSwitcher/LanguageSwitcher.js</strong></p><pre><em>// change</em><br><strong>const</strong> localeDict = {<br>    &#39;en-US&#39;: &#39;English&#39;,<br>    &#39;cs-CZ&#39;: &#39;Česky&#39;,<br>};</pre><pre><em>// to</em><br><strong>const</strong> localeDict = {<br>    &#39;en-US&#39;: &#39;English&#39;,<br>    &#39;fr-CA&#39;: &#39;Français&#39;,<br>};</pre><h4>Extract messages</h4><p>Messages that are used in the UI (via components, …) can be extracted for translation. You can think of it as a <a href="https://www.drupal.org/project/potx">potx</a> equivalent.</p><p>This command creates the json files in the /src/messages directory</p><pre>yarn run extractMessages<br><em># or just</em><br>yarn start</pre><p>Executing <em>yarn start</em> will also display <a href="https://en.wikipedia.org/wiki/Hubert_Reeves">Hubert Reeves</a> mother tongue in the Language Switcher, check it here<br><a href="http://localhost:3001/?lang=fr-CA">http://localhost:3001/?lang=fr-CA</a></p><p>You can provide translations for each <strong><em>message</em></strong> attribute in the /src/messages/fr-CA.json file that was generated.</p><p><a href="https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/docs/recipes/how-to-integrate-react-intl.md">More translation options</a> are covered on the documentation from the React Starter Kit.</p><h3>Create the components</h3><p>On this iteration, we will create two new React components :</p><ul><li><strong>AudioContentList</strong> : A translated list of Audio contents coming from Drupal, with a static localized introduction provided by a Markdown file.</li><li><strong>AudioContentPage</strong> : The detail page of an Audio content (with title, id, body, mp3)</li></ul><p>On the next iteration (part 3 of 3 from this tutorial), we will add</p><ul><li><strong>A profile selector</strong> (e.g. general, youth, blind), so we can demonstrate taxonomy term filtering by adding a term reference from a new Audio Profile vocabulary, on the Audio content type.</li><li><strong>Search</strong> on Audio id and title fields.</li><li>Display an image for each Audio on teaser and detail page, so we can also introduce a <strong>reusable component</strong> for each React “display mode” equivalent.</li><li><strong>Continuous play </strong>of the audio file while getting back to the list (YouTube app behavior).</li><li><strong>Post comments</strong> on Audio content.</li></ul><h4>Hold a global reference to the Drupal domain</h4><p>Edit the <strong>/src/constants/index.js</strong> file and append this const, not really sure if this is the best place but it seems to do the job.</p><pre><em>// Change by your Drupal dev environment</em><br>export <strong>const</strong> REST_HOST_NAME = &#39;http://audioguide.dev&#39;;</pre><p>Now we can head to the /src/components directory for creating our components.</p><h4>Create the AudioContentList component</h4><p>Create the AudioContentList directory that will hold 3 files :</p><ul><li>package.json</li><li>AudioContentList.js</li><li>AudioContentList.css</li></ul><p>This component uses two components provided by the boilerplate :</p><ul><li><strong>Page</strong> via inheritance</li><li><strong>Link</strong> via composition</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ac6370f56a8cc2dec0ece696b1db147/href">https://medium.com/media/4ac6370f56a8cc2dec0ece696b1db147/href</a></iframe><p>Note that the component should not fetch data on <em>componentDidMount</em> because, once mounted, it will not translate the nodes properly on language change.</p><p>So instead of what is mentioned in the code below, we should fetch the data from the route (see the React routing section below).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0200c7a074dee29f2537140599cc2dac/href">https://medium.com/media/0200c7a074dee29f2537140599cc2dac/href</a></iframe><p>Also, one downside of using the Route method instead of the <em>componentDidMount</em> is that the web service is called on each display. But for the sake of simplicity, we do not cover here another way of solving this (e.g. listen to language change and render again with the new data).</p><h4>Create the AudioContentPage component</h4><p>On this one, we make use of a component from the npm package repository to get a basic audio player wrapper of the html5 tag.</p><p>First add it.</p><pre>yarn add react-audio-player<br><em># note that this is similar to</em><br>npm install --save react-audio-player</pre><p>Create the AudioContentPage directory, with the same file structure</p><ul><li>package.json</li><li>AudioContentPage.js</li><li>AudioContentPage.css</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3530ab67218b11b7d0e8e44c157c7c0/href">https://medium.com/media/e3530ab67218b11b7d0e8e44c157c7c0/href</a></iframe><h3>React routing</h3><p>Go to the <strong>/src/routes</strong> directory.</p><h4>Create the audio content list route</h4><p>It will be the default route : <a href="http://localhost:3001/">localhost:3001/</a></p><p>Create the audio_list directory that will hold these 3 files :</p><ul><li>index.js : the routing file</li><li>audio_list.md : the default static content</li><li>audio_list.fr-CA.md : the French localized static content</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/514e0e1cadfb759dc8f3b291197210f4/href">https://medium.com/media/514e0e1cadfb759dc8f3b291197210f4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*-nyE8IM37D1yj_h7.png" /></figure><p>Here we use <a href="https://github.com/kriasoft/react-starter-kit/blob/feature/react-intl/docs/data-fetching.md">fetch</a> to get Drupal data. There are other solutions like <a href="https://github.com/mzabriskie/axios">Axios</a>, but fetch tends to become well adopted.<br>One noticeable fact is that we need to define this structure that complies JSON API <em>{ audioList: { data: [] } }.</em><br>Also, make sure that you have at least one node published as the JSON API module automatically filters unpublished nodes.</p><h4>Create the audio content page route</h4><p>The only noticeable change is the <strong>:id</strong> wildcard in the route that will be populated from the <em>AudioContentList</em>, with the Drupal node UUID. We make two calls : one for fetching the node, the other for the mp3 file. To be improved on the next iteration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6dd5ddc047b17a574fc0d2cfdbbbba78/href">https://medium.com/media/6dd5ddc047b17a574fc0d2cfdbbbba78/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*KQqMeGzCBDsXBjts.png" /></figure><h4>Reference the new routes</h4><p>Edit <strong>/src/routes/index.js</strong></p><p>Remove the unnecessary routes and add the new ones, so we end up with something like this.</p><pre>children: [<br>  require(&#39;./audio_list&#39;).default,<br>  require(&#39;./audio_page&#39;).default,<br>  <em>// Wildcard routes, e.g. { path: &#39;*&#39;, ... } (must go last)</em><br>  require(&#39;./notFound&#39;).default,<br>],</pre><p><a href="https://github.com/kriasoft/react-starter-kit/blob/master/docs/recipes/how-to-implement-routing.md">Routing documentation</a> from the React Starter Kit.</p><p>Finish by removing the references to all the unused components on the Header.js and Footer.js component definition.<br>Delete the <em>&lt;Navigation /&gt;</em> and <em>&lt;Link /&gt;</em> tags.</p><p>That’s all React folks, see you on the next iteration!</p><h3>Resources</h3><ul><li>Luciano Mammino <a href="https://speakerdeck.com/lmammino/universal-javascript-frontend-united-athens-2017">Universal JavaScript — Frontend United Athens 2017</a></li><li>Pieter Frenssen <a href="https://drive.google.com/file/d/1NNFyAAmcLRtEM1FfnJggcgLaHdUY3ZXzwzNNnEMoUkli8qYVPqO1B0LG8_wQz2YWBC-ZZbJ3kF2LwZzi/view">Working with Rest APIS — DrupalCamp Wrocław</a></li><li>Preethi Kasireddy <a href="https://medium.freecodecamp.com/internationalization-in-react-7264738274a0">Internationalization in React — FreeCodeCamp</a></li><li>Jake Archibald <a href="https://jakearchibald.com/2015/thats-so-fetch/">That’s so fetch!</a></li><li>Avraam Mavridis <a href="https://avraammavridis.com/talks/webpack">Webpack: Core concepts and “advance” topics</a></li><li>Preact <a href="https://github.com/developit/preact-cli">Progressive Web App boilerplate, in 30 seconds</a></li><li>Sitepoint <a href="https://www.sitepoint.com/rest-2-0-graphql/">REST 2.0 Is Here and Its Name Is GraphQL</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e95298d24ade" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React and Drupal 8 with JSON API 1/3]]></title>
            <link>https://medium.com/@colorfield/react-and-drupal-8-with-json-api-1-3-8c06006c440e?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c06006c440e</guid>
            <category><![CDATA[drupal]]></category>
            <category><![CDATA[drupal-8]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[json-api]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Wed, 17 May 2017 16:02:41 GMT</pubDate>
            <atom:updated>2017-05-19T13:49:56.196Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://colorfield.be/blog/react-and-drupal-8-json-api-1">Originally posted on colorfield.be.</a></p><p>The goal of this serie of posts is to achieve quickly a simple museum Audioguide web app based on a React <a href="https://medium.com/airbnb-engineering/isomorphic-javascript-the-future-of-web-apps-10882b7a2ebc#.4nyzv6jea">isomorphic</a> boilerplate with a Drupal 8 backend that uses the latest standards.</p><p>The web app will be fully decoupled by being hosted on another domain than the Drupal one.<br>As a real world case, we want it to be fully multilingual.</p><p>This is the first post of a serie of 3. This first one focuses on having a Drupal and React setup that meets our requirements.<br>The second one will define a MVP that will just fetch the audioguides list and a detail view (GET operation), the last one will then add extra features like getting user feedback (POST operation).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*cM1EUvPMjLltHzs7Xubqog.png" /></figure><h3>Drupal setup</h3><p>The easiest way to get started with Drupal and Composer is the Composer template for Drupal projects.</p><p>Head to your favourite VM / Apache / Nginx and follow the installation.</p><pre>composer create-project drupal-composer/drupal-project</pre><p>A <a href="https://github.com/drupal-composer/drupal-project">complete documentation</a> is available on GitHub.</p><p>For the web service, we will use the contrib JSON API module, as a replacement of the core Rest module.<br>It produces a cleaner output and is an “off of the Drupal island” approach by using a standard.</p><pre>composer require drupal/jsonapi</pre><p>To access to the JSON data from another domain (your localhost or the production web app domain), we will use the CORS module for simplicity.</p><pre>composer require drupal/cors</pre><p>Note that you can <a href="https://www.drupal.org/node/2715637">provide this configuration without this module</a>, because it is now in core since Drupal 8.2. However, keeping simplicity in mind, let’s go for the UI.</p><p>Then we want devel generate to provide some dummy content.</p><pre>composer require drupal/devel</pre><p>Enable the 3 modules</p><pre>drush en jsonapi cors devel devel_generate -y</pre><p>JSON API comes with zero configuration.</p><p>The CORS module can be configured under this page /admin/config/services/cors, just add this wildcard to get started and define the localhost with the port that will be used by the React app during development.</p><pre>*|http://localhost:3001</pre><p>Then generate 20 articles.</p><pre>drush genc 20 --types=article</pre><p>Your articles should now be available as a JSON API output under <a href="http://yourdrupal.domain/jsonapi/node/article.">http://yourdrupal.domain/jsonapi/node/article.</a><br>You can test the CORS setup and the JSON output via your IDE (e.g. <a href="https://www.jetbrains.com/phpstorm/">PHPStorm</a>), <a href="https://www.getpostman.com/">Postman</a> or Curl.</p><h3>React Starter Kit setup</h3><p>The <a href="https://reactstarter.com/">React Starter Kit</a> isomorphic boilerplate will be used to speed up the process and avoid <a href="https://medium.com/@ericclemmons/javascript-fatigue-48d4011b6fc4">Javascript fatigue</a>. It comes with wonderful documentation, is built on top of <a href="https://nodejs.org/">Node.js</a>, <a href="http://expressjs.com/">Express</a>, <a href="http://graphql.org/">GraphQL</a> and <a href="https://facebook.github.io/react/">React</a>, plus contains web development tools such as <a href="http://webpack.github.io/">Webpack</a>, <a href="http://babeljs.io/">Babel</a> and <a href="http://www.browsersync.io/">Browsersync</a>.</p><p>Because a requirement is to have fully multilingual support, we will clone the <a href="https://github.com/kriasoft/react-starter-kit/tree/feature/react-intl">feature/react-intl</a> branch that integrates the Yahoo <a href="https://github.com/yahoo/react-intl">React-Intl library</a> for internationalization.</p><p>Clone it in a separate directory than Drupal.</p><pre>git clone -b feature/react-intl <a href="https://github.com/kriasoft/react-starter-kit.git">https://github.com/kriasoft/react-starter-kit.git</a></pre><p>Make sure that you have <a href="https://yarnpkg.com/lang/en/docs/install/">Yarn installed</a> then cd into the cloned directory.</p><p>The installation is quite straigthforward and faster than npm.</p><pre>yarn install</pre><p>Start the Node.js server and <a href="https://browsersync.io/">Browsersync</a> with <a href="https://webpack.github.io/docs/hot-module-replacement">HMR</a> on top of it.</p><pre>yarn start</pre><p>More documentation on the React Starter Kit <a href="https://github.com/kriasoft/react-starter-kit/blob/master/docs/getting-started.md">getting started</a> section.</p><p>And voila ready to code!<br>See you soon for the next part.</p><h3>Resources</h3><ul><li>Drupal.org : <a href="https://www.drupal.org/docs/8/modules/json-api/api-overview">JSON API documentation</a></li><li>DrupalCon Baltimore 2017 : <a href="https://events.drupal.org/baltimore2017/sessions/advanced-web-services-json-api">Advanced Web Services with JSON API</a></li><li>Four Kitchens : <a href="https://www.fourkitchens.com/blog/events/api-first-drupal-8-react-and-you/">API First Drupal 8, React, and You!</a></li><li>Acquia : <a href="https://www.acquia.com/fr/blog/decoupled-drupal-ember-introducing-ember-and-json-api/14/12/2016/3302446">Decoupled Drupal with Ember: Introducing Ember and JSON API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c06006c440e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scrum in a small team with multiple projects]]></title>
            <link>https://medium.com/@colorfield/scrum-in-a-small-team-with-multiple-projects-b19d9cc84f84?source=rss-ed65d74666c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b19d9cc84f84</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[drupal]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Christophe Jossart]]></dc:creator>
            <pubDate>Sat, 01 Oct 2016 11:17:03 GMT</pubDate>
            <atom:updated>2016-10-01T14:13:45.542Z</atom:updated>
            <content:encoded><![CDATA[<p>Originally posted on <a href="https://colorfield.be/blog/scrum-small-team-multiple-projects">colorfield.be</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DxhgLwV5Ydlnhnr7sgXRUg.png" /></figure><p>Summer was inspiring! A really pragmatic talk on <a href="http://milan2016.drupaldays.org/node/160">how to apply Scrum</a> from <a href="https://twitter.com/dasjo">dasjo</a> at the Drupal Dev Days Milan acted as a kick-starter and we decided to apply it in our small Drupal dev team at Tilt Factory.<br> Our team is composed by 2 at the front end, 3 at the backend, with people combining responsibilities like PM and sysadmin. We have 5 to 10 concurrent projects with ~ 30 projects to maintain.</p><h3>Where did we start from?</h3><p>After 400+ pages reading about the Scrum theory, a few months ago, our first reaction was that it was not compatible with multiple projects (e.g. how to apply in sprints?) and urgent client requests that are most of the time perceived as intrusive.</p><p>This summer, we decided to give it another try, and began by re-reading the <a href="http://agilemanifesto.org/principles.html">Agile manifesto</a>. We were pleased to remember that we already applied most of the principles that were described here:</p><ul><li>customer satisfaction with a preference for simplicity</li><li>self-organizing team that welcomes changes and communicates well</li><li>frequent delivery</li><li>constant refactoring for sustainability</li><li>…</li></ul><p>We wanted to keep our tools intact to get started. Most of the people from the dev team welcomes changes but it also involves clients and the management team that already have to handle a bunch of other tools. We also wanted to avoid several changes at a time and see if it was possible to adapt within the same infrastructure.</p><p>We were already using</p><ul><li><strong>Trello</strong> to allow every person to get easily into the Kanban (sales, product owner / client, scrum master, dev team). Jira looks more like a dev tool and we wanted everybody to feel comfortable with it.</li><li><strong>GitHub</strong> for the Wiki</li></ul><p>The main question was: how to improve our methodology? Even if we were iterating on each step, we tended to be really sequential (all the mockups, then all the layouts, then all the dev, …).</p><p>The downsides of this approach are</p><ul><li>Too much specifications, this does not reflect the reality of a web project that must welcome changes.</li><li>A delay on one step have consequences on the other, plannings are not well perceived and often it is interpreted as a lack of professionalism.</li><li>The website was still kind of broken a few weeks before the launch.</li><li>We tended to give too much detail on one step, consuming the budget and the time without a bird eye view of the priorities.</li><li>It was often driven by a single person (the project manager), that quickly became a bottleneck instead of a facilator.</li></ul><p>Second, how to get a clean approach under our Kanban (Trello)?<br> The client have access to it and the granularity was not always the same, depending on the person. Also, the GitHub Wiki was a huge resource… but to be honest it was a bit chaotic, due to the lack of contribution guidelines.</p><h3>Scrum in the wild</h3><p>Here is what we applied from what we learned, mostly taken from the ressources section at the end of this post but also with a taste of our culture.</p><h4>Pleased to meet you</h4><p>We always begin by an informal discussion with the client. It is really fundamental. We will work several months together on a project, the human relation have to match. If we agree on the big picture, we go on with basic questions over the client company and the project (mission, primary objectives of the project, current situation, audience, budget, …).<br> This documentation is maintained on the GitHub Wiki during the project to get easy onboarding and refer to it at each stage.</p><h4>The design sprint</h4><p>This is the project kickstart, ideally the first sprint. The whole team (client included) is involved / empowered.</p><ul><li><strong>Discover the project</strong>: analytics if any, personas, user stories and flow</li><li><strong>Free your mind</strong>: creative approach by throwing ideas, getting inspired by other cases, …</li><li><strong>Live mockups</strong>: quick sketch and prototyping</li><li><strong>Roadmap</strong>: define user stories, estimate and retain what is for the next sprints and what is for the icebox (see later: Scrum board).</li></ul><h4>User stories</h4><p>For each user story (or issue at a later stage), we have a common structure, inspired from the Drupal community. What we really like is the problem/motivation + proposed resolution approach. Nothing really comes out of the blue (you know, the I-have-seen that-on-this-website-this-is-really-what-we-need syndrome). However, the creative and “stumble” approach part is still admitted in the product backlog (see later: Scrum board).</p><p>Here is the structure, taken from the <a href="https://www.drupal.org/issue-summaries">Drupal issue summary template</a>:</p><ul><li>Problem / Motivation</li><li>Proposed resolution</li><li>Remaining tasks</li><li>User interface changes</li><li>API changes</li><li>Data model change</li></ul><p>We also complete this by what is the <em>acceptance test</em>, so we know when we can move it from “In progress” to “Done” (see below).</p><p>Each issue is a Trello card, so everyone that takes part to the project can comment it. We can also use the Trello checklist to get a clear overview of remaining tasks. Most of the time, a task can reference a GitHub issue.</p><p>Every developer can</p><ul><li>self-assign tasks and/or onboard on the issue card</li><li>review what was commited on GitHub because each commit references the issue.</li></ul><p>Unit tests are implemented to be sure that it will continue to work after a change (CI).</p><h4>Scrum board</h4><p>The columns that we retained are</p><ul><li><strong>Product backlog</strong>: tolerance for different granularity, throw ideas that comes from meetings, observations, …</li><li><strong>Sprint planning</strong>: stories to estimate</li><li><strong>Current sprint</strong>: what has to be done</li><li><strong>In progress</strong>: what we are actually working on</li><li><strong>Done</strong>: what has passed acceptance tests and is live</li><li><strong>Icebox</strong>: ideas for next sprints</li></ul><p>The issues naming convention for a user story is typically “As a {user type} I want to {action needed}”. Here we replace the user type by Trello labels (front and backend developers in this case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*EJCY_txG4nwUw7SNkaX3vg.png" /></figure><h4>Scrum ritual</h4><p>The ritual was explained to the team and the client.</p><ul><li>We have small to medium sized projects that takes from 2 months to 1 year, so <strong>sprints</strong> are short: one week. The former “project manager” became the <strong>product owner</strong> of the team, so he can define priorities between the clients.</li><li>The <strong>Scrum master</strong> reports, solves the dev team issues, coaches about the Scrum process, is the link between the dev team and the client (product owner). He protects the dev team planning. In our company, it is not a full time job.</li><li>We begin each day by <strong>standup meetings</strong> with the whole team (5 to 10 minutes): what has been done yesterday, what are we working on today and what are the blockers, so each person can help or assign the other, depending on the skills and the charge. We achieve the same goal.</li><li>We propose a <strong>backlog grooming </strong>and <strong>retrospective</strong> with the client, he can discuss with the whole team so he is part of it. We can review what has been done (deployed live after passing acceptance tests) and what was not. It also avoids interpretations from a single point of contact.</li><li>The <strong>poker planning </strong>is done for issues estimation. People that have differences must explain why. We use points instead of hours (that strongly depends on how fast a person is on a task). Points reflects <em>what the team can accomplish</em>.</li><li>We also have a <strong>weekly retrospectives</strong> of what worked well and what can be improved. The scope is within the dev team and the process with the client, so we can adapt quickly.</li><li>For urgent requests, we have a <strong>fastline</strong>, we foresee a day in the sprint for ticketing and helpdesk. SLA is defined with the client as well.</li></ul><h4>Tools improvement</h4><p>We used Trello power ups to get the integration with GitHub and reference issues in the Trello cards. All the “dev only” discussion is in the GitHub issue tracker or Wiki. This last one is also used for new developers (freelancers, client team, …) onboarding.<br> We also use the <a href="https://chrome.google.com/webstore/detail/scrum-for-trello/jdbcdblgjdpmfninkoogcfpnkjmndgje">Scrum for Trello Chrome extension</a> to have a clear overview of estimates.<br> Nowadays, we consider adopting GitLab, that have a global approach.</p><h4>Getting inspired</h4><p>When we decided to compare it to a practical case that worked, we observed <a href="https://github.com/goalgorilla/drupal_social">how the Open Social distribution was built</a>: user stories, roadmap, lo-fi prototype, style guide, …<br> Once again, we were pleased to see that it was an improvement of what we already used.</p><h3>Conclusion</h3><p>I think that most of the teams are already applying Agile without knowing it, and there is very little effort to apply your own flavor and get the pleasure of doing things the “right” way.</p><p>I will repeat here the conclusions of dasjo about the benefits of Scrum:</p><ul><li>More ownership — transparency</li><li>Less bottlenecks</li><li>Better quality — team members test each others, think differently about code</li><li>More motivation</li><li>Constant learning curve</li></ul><h3>Ressources</h3><ul><li>SOS — We need a Scrum process! Going from specification to collaboration<br><a href="https://www.youtube.com/watch?v=TC-cmsBgHdg">Video</a>, <a href="http://slides.com/dasjo/scrum">Slides</a></li><li><a href="http://blog.trello.com/beginners-guide-scrum-and-agile-project-management/">The Beginner’s Guide To Scrum And Agile Project Management</a></li><li><a href="https://www.previousnext.com.au/blog/why-project-managers-need-lose-control-0">Why project managers need to lose control</a></li><li><a href="https://theagilecoder.wordpress.com/2013/11/11/how-to-set-up-trello-board-for-scrum/">How to set up Trello Board for Scrum</a></li><li><a href="https://trello.com/c/X6ky8mJF/15-using-trello-as-a-scrum-board">Using Trello as a Scrum board</a></li><li><a href="http://www.scrumguides.org/scrum-guide.html">The Scrum Guide</a></li><li><a href="http://referentiel.institut-agile.fr/">Référentiel Agile</a> (in french)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b19d9cc84f84" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>