Drupal https://danlobo.co.uk/ en Getting started with Remote Images in Drupal https://danlobo.co.uk/article/getting-started-remote-images <span property="schema:name">Getting started with Remote Images in Drupal</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2020-11-18T19:10:33+00:00">Wed, 18/11/2020 - 19:10</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>In a previous article I touched on the oEmbed standard and a little about the use of remote media including remote images.</p> <p>Of course embedding images into to page whether hosted remotely or locally is not a new thing. Embedding remote images from the Drupal UI is not supported out of the box. Of course you can manually edit the html using your wysiwyg editor, but that is not very user friendly and is not a great user experience. Furthermore doing so increases that the risk your markup may be malformed etc</p> <p><a href="https://www.drupal.org/project/remote_stream_wrapper">Remote Steam Wrapper</a></p> <blockquote><p>This contributed module provides the ability to use external files with file fields without saving the files to your local files directory. Also provides a 'Remote URL' browser plugin for <a href="https://www.drupal.org/project/media">Media</a>.</p> </blockquote> <p>So what is a Stream Wrapper?</p> <blockquote><p>Streams are the way of generalizing file, network, data compression, and other operations which share a common set of functions and uses. In its simplest definition, a stream is a resource object which exhibits streamable behavior. That is, it can be read from or written to in a linear fashion, and may be able to <a href="https://www.php.net/manual/en/function.fseek.php">fseek()</a> to an arbitrary location within the stream.</p> </blockquote> <blockquote><p>A wrapper is additional code which tells the stream how to handle specific protocols/encodings. For example, the http wrapper knows how to translate a URL into an HTTP/1.0 request for a file on a remote server. There are many wrappers built into PHP by default (See <a href="https://www.php.net/manual/en/wrappers.php">Supported Protocols and Wrappers</a>), and additional, custom wrappers may be added either within a PHP script using <a href="https://www.php.net/manual/en/function.stream-wrapper-register.php">stream_wrapper_register()</a>, or directly from an extension using the API Reference in <a href="https://www.php.net/manual/en/internals2.streams.php">Working with streams</a>. Because any variety of wrapper may be added to PHP, there is no set limit on what can be done with them. To access the list of currently registered wrappers, use <a href="https://www.php.net/manual/en/function.stream-get-wrappers.php">stream_get_wrappers()</a>.</p> </blockquote> <p><a href="https://www.php.net/manual/en/intro.stream.php">https://www.php.net/manual/en/intro.stream.php</a></p> <h3>Remote URL Browser</h3> <p>Here we can what the see the Remote URL Browser plugin looks like. Here we can see the a thumbnail list view of the remote images. These images are saved as thumbnails locally and can be configured from the Media Library Display options.</p> <div data-align="center"> <div class="field field--name-field-media-image field--type-image field--label-visually_hidden"> <div class="field--label sr-only">Image</div> <div class="field--item"> <img loading="lazy" src="/sites/default/files/2020-11/Screenshot%202020-11-18%20at%2019.26.02.png" width="2450" height="1314" alt="Remote Images" typeof="foaf:Image" class="img-responsive" /></div> </div> </div> <p>To add a remote image using the remote stream wrapper plugin, we can create a new Media Type and then create a new remote image field that we will use store our remote images.  </p> <h3>Rendering a Remote Image using remote stream wrapper and image styles</h3> <p>Here's how it is rendered on the front end:</p> <pre> <code class="language-html">&lt;div class="field--item"&gt; &lt;a href="https://live.staticflickr.com/65535/50617412076_0ca2847075_b.jpg" target="_blank" rel="noopener"&gt; &lt;img src="https://live.staticflickr.com/65535/50617412076_0ca2847075_b.jpg" width="709" height="1024" typeof="foaf:Image" class="img-responsive"&gt; &lt;/a&gt; &lt;/div&gt; </code></pre><p>Furthermore it gives you the option to add image styles, which is useful for controlling how a view looks and behaves. As far as I can tell this does make a copy of the remote image and keep a copy in the local files directory along with other image styles, but also allows you to display the original source image and even link to it if required.</p> <p>Here's what the markup looks like</p> <pre> <code class="language-html">&lt;div class="field--item"&gt; &lt;img src="/sites/default/files/styles/large/https/live.staticflickr.com/65535/50617412076_0ca2847075_b.jpg?itok=VAUiE2tm" width="332" height="480" typeof="foaf:Image" class="img-responsive"&gt; &lt;/div&gt; </code></pre><p>Notice how this works somewhat differently to Drupal core that would probably strip out or reject any query string attached to an image by default</p> <p><a href="https://www.drupal.org/project/remote_stream_wrapper_widget">Remote Steam Wrapper Widget</a></p> <p>If you use the Remote Steam Wrapper Module, chances are you will also need the Remote Steam Wrapper Widget. This provides a field formatter when editing your remote steam wrapper image file field! Once enabled you should be able to change the form display.</p> <blockquote><p>This project provides a file/image widget implementation of the API provided by <a href="https://drupal.org/project/remote_stream_wrapper" rel="nofollow">remote stream wrapper</a>.</p> <p>It currently only supports entering the URL (similar to entering a path to an image) but will in time gain feature parity with core's file and image widgets.</p> </blockquote> <p>Notice how we can have attach multiple fields to media types. Here is an example that shows how we configure the widget on the form display of our media entity, on the image field!</p> <div data-align="center"> <div class="field field--name-field-media-image field--type-image field--label-visually_hidden"> <div class="field--label sr-only">Image</div> <div class="field--item"> <img loading="lazy" src="/sites/default/files/2020-11/Screenshot%202020-11-18%20at%2019.29.01.png" width="3240" height="1622" alt="widget" typeof="foaf:Image" class="img-responsive" /></div> </div> </div> <p>Here we can see what the widget formatter looks like. We can see the option to add a path to the url rather than the typical file upload button</p> <div data-align="center"> <div class="field field--name-field-media-image field--type-image field--label-visually_hidden"> <div class="field--label sr-only">Image</div> <div class="field--item"> <img loading="lazy" src="/sites/default/files/2020-11/Screenshot%202020-11-18%20at%2019.46.37.png" width="2644" height="1248" alt="widget" typeof="foaf:Image" class="img-responsive" /></div> </div> </div> <p>Ok thats it. You now know how you can  embed  remote images on your site in a secure way that also allows you to take advantage of the benefits of the media module UI. it should be possible to embed images in a secure way that also plays nicely with the Drupal ecosystem. It is also possible to insert dynamically generated images or in other words images do not have to have an appropriate mime/style extension in order to be displayed.</p> <p>For more info on getting started with remote stream wrapper visit <a href="https://www.drupal.org/docs/contributed-modules/how-to-use-remote-stream-wrapper-with-core-media-module">https://www.drupal.org/docs/contributed-modules/how-to-use-remote-strea…</a></p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/taxonomy/term/195" property="schema:about" hreflang="en">embed</a></div> <div class="field--item"><a href="/taxonomy/term/194" property="schema:about" hreflang="en">media</a></div> <div class="field--item"><a href="/taxonomy/term/196" property="schema:about" hreflang="en">remote stream wrapper</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=130&amp;2=comment_node_article&amp;3=comment_node_article" token="MwkE0--H0wTBKkeBePDS67RAOLYtf8xHPAAa6YImFWo"></drupal-render-placeholder> </section> Wed, 18 Nov 2020 19:10:33 +0000 daniel 130 at https://danlobo.co.uk Support for oEmbed opens up wealth of opportunities for embedded content https://danlobo.co.uk/article/support-oembed-opens-wealth-opportunities-embedded-content <span property="schema:name">Support for oEmbed opens up wealth of opportunities for embedded content</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2020-11-18T15:01:14+00:00">Wed, 18/11/2020 - 15:01</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Drupal 8.6.0 has an out-of-box adds support for embedding remote YouTube and Vimeo videos by means of the oEmbed format. You may notice these are often encapsulated in an iframe. You can see this evident in a new media type being defined called 'Remote Video' available form /admin/structure/media. A new icon is also available form your wysiwyg that allows you to embed the new format in your page or block.</p> <div data-align="center"> <div class="field field--name-field-media-image field--type-image field--label-visually_hidden"> <div class="field--label sr-only">Image</div> <div class="field--item"> <img loading="lazy" src="/sites/default/files/2020-11/Screenshot%202020-11-18%20at%2016.23.26.png" width="1986" height="102" alt="wyswyg icons" typeof="foaf:Image" class="img-responsive" /></div> </div> </div> <p>Selecting this we see that the default options for remote video, aka oEmbed, are restricted to Youtube and Vimeo. Remember The <em>Embed media</em> filter must be enabled to use the <em>Insert from Media Library</em> button.</p> <div data-align="center"> <div class="field field--name-field-media-image field--type-image field--label-visually_hidden"> <div class="field--label sr-only">Image</div> <div class="field--item"> <img loading="lazy" src="/sites/default/files/2020-11/Screenshot%202020-11-18%20at%2015.22.26.png" width="1082" height="850" alt="media remote video - oembed" typeof="foaf:Image" class="img-responsive" /></div> </div> </div> <p>Media's oEmbed support provides support for the full list of oEmbed providers listed <a href="https://github.com/iamcal/oembed/tree/master/providers">https://github.com/iamcal/oembed/tree/master/providers</a> or <a href="https://oembed.com/providers.json">https://oembed.com/providers.json</a>. This can also be extended to non canonical  providers and in fact in Drupal there is a a contributed module to help with customising support for additional oEmbed providers - <a href="https://www.drupal.org/project/oembed_providers">https://www.drupal.org/project/oembed_providers</a>.</p> <p>Drupal provides a framework that will allow you to add support for embedding others websites content on your page, and with some custom coding this can be achieved. More info on that <a href="https://www.savaslabs.com/blog/oembed-drupal-8">https://www.savaslabs.com/blog/oembed-drupal-8</a></p> <p>Here we have a look at some of the listed oEmbed providers that are worth looking at in my opinion</p> <ol><li><a href="https://hearthis.at/">https://hearthis.at/</a> - Alternative to Soundcloud - seems more community driven</li> <li><a href="https://soundcloud.com">https://soundcloud.com</a> - The original audio streaming community</li> <li><a href="https://www.rcvis.com">https://www.rcvis.com</a> - Charts, graphs, and tables to help your audience understand the results of a Ranked Choice Voting election. Export to Wikipedia, embed with HTML, or share to social media.</li> <li><a href="https://odesli.co">https://odesli.co</a> - add smart links designed to promote your song album or podcast</li> <li><a href="https://www.flickr.com">https://www.flickr.com</a> - photo sharing</li> <li><a href="https://mixcloud.com">https://mixcloud.com</a> - mix show sharing platform</li> <li><a href="https://learningapps.org">https://learningapps.org</a> - LearningApps.org is a Web 2.0 application, to support learning and teaching processes with small interactive modules.</li> <li><a href="scribblemaps.com">scribblemaps.com</a> - Easily create embeds, images, and map data for free.</li> <li><a href="https://showtheway.io/">https://showtheway.io/</a> - embed a link to your location</li> <li><a href="https://sketchfab.com">https://sketchfab.com</a> - Upload and embed 3d model viewer</li> </ol><div class="sketchfab-embed-wrapper"> <iframe id="" title="" class="" width="640" height="360" src="https://sketchfab.com/models/a40e20a288004a83be30dc155bba20f9/embed" frameborder="0" allow="autoplay; fullscreen; xr-spatial-tracking" allowfullscreen="" mozallowfullscreen="true" webkitallowfullscreen="true" xr-spatial-tracking="true" execution-while-out-of-viewport="true" execution-while-not-rendered="true" web-share="true"></iframe></div> <div class="sketchfab-embed-wrapper"> <iframe id="" title="" class="" width="640" height="360" src="https://sketchfab.com/models/e006d9bcdcbd48139595276b3993ede3/embed" frameborder="0" allow="autoplay; fullscreen; xr-spatial-tracking" allowfullscreen="" mozallowfullscreen="true" webkitallowfullscreen="true" xr-spatial-tracking="true" execution-while-out-of-viewport="true" execution-while-not-rendered="true" web-share="true"></iframe></div> <p>There are 2 to 3 hundred oEmbed canonical providers listed by default at the time of writing. However there are probably many more non official providers that support the <a href="https://oembed.com">oEmbed</a> standard. I would be interested to know of any that you think also deserve a mention.</p> <p>It is also worth mentioning that their is the <a href="https://www.drupal.org/project/url_embed">url_embed</a>  module that adds support for all these providers and makes it easy to add via your wysiwyg.  That said it seems that different oEmbed providers will need to be handled separately as they likely to have non standard attributes when it comes to setting width and height to be displayed etc. In fact there are various 'types' of oembed including photo, video, link, and rich. Notably the main delta here is that photo expects an 'url' attribute as opposed to a html key value pair expected for video, link and rich.</p> <p>url_embed is dependent on the <a href="https://www.drupal.org/project/embed">embed</a> module that provides the underlying framework for embedding documents using your wysiywg editor. </p> <p>Also when displaying the html attribute, it is recommended to  `load the HTML in an off-domain iframe to avoid XSS vulnerabilities'`. <a href="https://oembed.com">https://oembed.com</a>. Drupal makes it easy for you to do this. More on that later.</p> <p>If you want to check how your chose oEmbed content looks, check out <a href="https://iframely.com/embed">http://debug.iframely.com</a></p> <p> </p> <p> </p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/193" property="schema:about" hreflang="en">oembed</a></div> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/taxonomy/term/194" property="schema:about" hreflang="en">media</a></div> <div class="field--item"><a href="/taxonomy/term/195" property="schema:about" hreflang="en">embed</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=129&amp;2=comment_node_article&amp;3=comment_node_article" token="Gs3eP0iSNVyXHjhr2q2NZFrwwzYI4x3uo3VrYO1CpZM"></drupal-render-placeholder> </section> Wed, 18 Nov 2020 15:01:14 +0000 daniel 129 at https://danlobo.co.uk Drupal 8.7.7 adds semantic versioning support https://danlobo.co.uk/article/drupal-9-adds-semantic-versioning <span property="schema:name">Drupal 8.7.7 adds semantic versioning support</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2020-11-11T17:14:39+00:00">Wed, 11/11/2020 - 17:14</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>One of the changes introduced&nbsp;with the launch of&nbsp;Drupal 8.7.7&nbsp;included&nbsp;support for semantic versioning.&nbsp;<a href="https://semver.org">The Semantic Versioning</a> specification was originally authored by&nbsp;<a href="https://tom.preston-werner.com/">Tom Preston-Werner</a>, inventor of Gravatar and cofounder of GitHub. We are currently on&nbsp;Semantic Versioning 2.0.0.</p> <p>First introduced in Drupal 8.7.7 the new&nbsp;<a href="https://www.drupal.org/node/3070687"><code>core_version_requirement</code></a>&nbsp;key in&nbsp;<code>*.info.yml</code>&nbsp;files for modules, themes, and profiles now supports semantic versioning as implemented by the Composer project. This allows modules, themes, and profiles to also specify that they are compatible with multiple major versions of Drupal core.</p> <p>For example a module that is compatible with Drupal 8 and Drupal 9 can have a info.yml file like this</p> <pre> <code>name: My Module type: module core: 8.x core_version_requirement: ^8 || ^9</code></pre><p>This specifies that the module is compatible with all versions of Drupal 8 and 9. The&nbsp;<code>core:</code>&nbsp;is required here because Drupal Core versions before 8.7.7 do not recognize the&nbsp;<code>core_version_requirement:</code>&nbsp;key.</p> <p>Most modules however&nbsp;<a href="https://www.drupal.org/docs/9/how-to-prepare-your-drupal-7-or-8-site-for-drupal-9/deprecation-checking-and-correction-tools" rel="nofollow">will have to remove deprecated code to be compatible with Drupal 9</a>. Therefore they will not able to be compatible with all versions of Drupal 8.</p> <p>For example a module that is compatible with Drupal 8 versions after Drupal 8.8.0 and also Drupal 9 will need a info.yml file like this:</p> <pre> <code>name: My Module type: module core_version_requirement: ^8.8 || ^9</code></pre><p>The&nbsp;<code>core:</code>&nbsp;key&nbsp;<strong>must not be used here</strong>&nbsp;to make sure that versions of Drupal before 8.7.7 will not install the module. Adding both core and core_version_requirement with anything other than&nbsp;<code>core_version_requirement: ^8 || ^9</code>&nbsp;will result in an exception.</p> <p>The&nbsp;<code>core_version_requirement</code>&nbsp;<strong>cannot</strong>&nbsp;be used to restrict to core version before 8.7.7. For instance,&nbsp;<code>core_version_requirement: ^8.7 || ^9</code>&nbsp;would throw a parsing exception: This is not valid because&nbsp;<code>^8.7</code>&nbsp;would include versions like 8.7.0 which do not recognize the&nbsp;<code>core_version_requirement: </code>key.</p> <p>It is also possible to specify the same requirement in composer.json, but if no drupal/core requirement is defined there, one will automatically be generated based on&nbsp;<code>core_version_requirement</code>.&nbsp;</p> <pre> <code>{ "require": { "drupal/core": "^8.7.7 || ^9" } }</code></pre><p>&nbsp;</p> <p>Drupal's <a href="https://www.drupal.org/project/project_composer">project_composer</a>&nbsp;provides an adaptor for modules hosted on drupal.org to the composer command line utility.&nbsp;It is intended to be run on drupal.org infrastructure to provide a shim that can translate drupal modules, submodules and their drupal specific versioning scheme into something that can be consumed by the composer command line utility.&nbsp;It aims to have API parity with packagist.org as far as the composer command line tool is concerned.</p> <p>Ok so we can see that in Drupal prior to 8.7.7&nbsp;module versions&nbsp;were effectively shimmed with the patched part effectively being ignored.&nbsp;</p> <p>So we can see that it would be better to not have to patch the version in order to make use of semantic versioning. This change basically that code change will definitely be required in your module or theme in order to support the new use of semantic versioning in Drupal 9.</p> <p><a href="https://www.drupal.org/node/1015226#semver-transition">Transitioning from 8.x.-*&nbsp;to x.y.x</a></p> <blockquote><p>Since Drupal 8, projects can be compatible with any range of Drupal core versions. So&nbsp;<code>8.x-*</code>&nbsp;releases and releases using semantic versioning occupy the same space for version numbers. Put another way, a&nbsp;<code>8.x-1.0</code>&nbsp;release is effectively the same as&nbsp;<code>1.0.0</code></p> <p><em>When your project switches to using semantic versioning, you must increment your major version.</em>&nbsp;For example, if the latest release is&nbsp;<code>8.x-3.5</code>, your next stable release will be&nbsp;<code>4.0.0</code></p> <p>(The converse is also restricted, once&nbsp;<code>4.0.0</code>&nbsp;is released, you can’t release&nbsp;<code>8.x-4.0</code>&nbsp;or&nbsp;<code>8.x-5.0</code>)</p> <p><code>8.x-*</code>&nbsp;projects can be compatible with Drupal 9, so you don’t need to switch right away if you aren’t ready to start a new major version release series.</p> <p>Most versions of Drupal 8 are not compatible with semantic versioning. If your project supports Drupal 8.8.3 or lower, don’t switch to semantic versioning.</p> <p><em><code>9.x-*</code>&nbsp;and later releases can not be made.</em>&nbsp;Since most releases made now are likely to be compatible with multiple versions of Drupal core, the API compatibility prefixes don’t make sense to keep. Use semantic versioning for any release only compatible with Drupal 9 or higher.</p> <p>With semantic versioning,&nbsp;<code>composer.json</code>&nbsp;and&nbsp;<a href="https://www.drupal.org/node/3070687"><code>core_version_requirement</code></a>&nbsp;are used to define a release’s requirement for Drupal core.</p> </blockquote> <p><a href="https://www.drupal.org/node/1015226#semver-transition">https://www.drupal.org/node/1015226#semver-transition</a></p> <h2>Summary</h2> <p>So we can see that since Drupal 8.7.7 support for semantic versioning&nbsp;gives the ability for Drupal&nbsp;modules, themes and profiles to</p> <ol> <li>Work across multiple versions of drupal core, (currently&nbsp;8/9. Versions of modules are no longer constrained to the version of Drupal! That said this really means modules could run on &gt;8.7.7. and &gt; 9.0.0</li> <li>Eliminate dependency of drupal's project composer shim that does not utilise the patch version number</li> <li>Support for patch numbers</li> <li>Introduces a new&nbsp; new&nbsp;<code>core_version_requirement</code>&nbsp;key in&nbsp;<code>*.info.yml</code>&nbsp;to&nbsp;specify the&nbsp;multiple major versions of Drupal core.that it is &nbsp;compatible with</li> <li>the core key is still a requirement for modules that continue to run on versions prior to&nbsp;8.7.7 - but adding both core and core_version_requirement with anything other than&nbsp;<code>core_version_requirement: ^8 || ^9</code>&nbsp;will result in an exception - in other words you cannot use&nbsp;<code>core_version_requirement: ^8.6 || ^9.&nbsp;</code></li> </ol> <p>&nbsp;</p> <p>The decision to introduce semantic versioning prior to launching Drupal 9.0.0 was probably a good one that allowed modules maintainers to prepare themselves prior to&nbsp;looking at <a href="https://www.drupal.org/project/drupal/releases/9.0.0">other changes</a> moving from 8-9, as well as offering compatibility&nbsp;between the two major versions of Drupal and a kinder upgrade path.</p> <p>&nbsp;</p> <p>&nbsp;</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/taxonomy/term/190" property="schema:about" hreflang="en">semantic versioning</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=127&amp;2=comment_node_article&amp;3=comment_node_article" token="Pc-6cnpb9JeXmPgpJb6GOmSnPc9_CEZ34YMo45gPgb8"></drupal-render-placeholder> </section> Wed, 11 Nov 2020 17:14:39 +0000 daniel 127 at https://danlobo.co.uk Cohesion makes sense for Acquia https://danlobo.co.uk/article/cohesion-acquisition-makes-lot-sense-acquia <span property="schema:name">Cohesion makes sense for Acquia </span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2019-10-02T11:14:37+00:00">Wed, 02/10/2019 - 12:14</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/taxonomy/term/155" property="schema:about" hreflang="en">DX8</a></div> <div class="field--item"><a href="/taxonomy/term/156" property="schema:about" hreflang="en">Cohesion</a></div> <div class="field--item"><a href="/taxonomy/term/157" property="schema:about" hreflang="en">Acquia</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=112&amp;2=comment_node_article&amp;3=comment_node_article" token="hPX_feG-yCr7HmGXisFeYh48mxXmRYOaa7yioNv0eWk"></drupal-render-placeholder> </section> Wed, 02 Oct 2019 11:14:37 +0000 daniel 112 at https://danlobo.co.uk Latest Drupal release drops support for php 5 https://danlobo.co.uk/article/latest-drupal-release-drops-support-for-php-5 <span property="schema:name">Latest Drupal release drops support for php 5</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2019-05-02T12:42:33+00:00">Thu, 02/05/2019 - 13:42</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Yesterday, May 1st 2019,&nbsp;Drupal announced the latest stable iteration&nbsp;to their open source CMS Drupal 8.7.0. There were a number of announcements including&nbsp;</p> <ol> <li>JSON API module becomes stable and&nbsp;enables&nbsp;Drupal sites to double up as restful API's</li> <li>Improvements to the experimental Media module</li> <li>Stable release of new core Layout Builder Module</li> <li>Custom menu links and taxonomy terms are now revisionable, which allows them to be used in editorial workflows</li> <li>The Umami food magazine demo now includes&nbsp;a new welcome tour, Layout Builder integration for recipes, and multilingual features.</li> </ol> <p>Also of note is that this release coincides with the phasing out of support for php 5.</p> <blockquote> <p>Note that new Drupal 8.7.0 installs now require at least PHP 7.0.8.&nbsp;<a href="https://www.drupal.org/node/3044409">Existing sites still work on at least PHP 5.5.9 for now, but will display a warning</a>. Drupal security updates will begin requiring PHP 7 as early as Drupal 8.8.0 (December 2019), so&nbsp;<strong>all users are advised to update to at least PHP 7.0.8 now</strong>.</p> <p>https://www.drupal.org/blog/drupal-8-7-0</p> </blockquote> <blockquote> <p><a href="http://php.net/supported-versions.php">PHP 5.5 has already reached official end-of-life in 2016</a>. PHP 5.6 also stopped receiving active support from PHP maintainers in January 2017 (i.e., it no longer receives bugfixes, even for some very serious bugs that impact Drupal development) and will reach its EOL in December 2018.</p> <p>https://www.drupal.org/node/2938726</p> </blockquote> <p>With php 7 offering many benefits over php 5 including security and bug fixes and of&nbsp;course performance improvements, it is somewhat surprising to see that of the 79.1% share of websites where php is used server&nbsp;side, the latest stats show that the majority, approx 67%, are&nbsp;still running php 5!</p> <p><a href="https://w3techs.com/technologies/details/pl-php/5/all" target="_blank">https://w3techs.com/technologies/details/pl-php/5/all</a></p> <p>Perhaps we will see a last minute rush of Drupal sites being updated from php 5 before the end of this year? If you have not updated yet, now might be a good a time as any&nbsp;to look into it.&nbsp;</p> <p>&nbsp;</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">PHP</a></div> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=108&amp;2=comment_node_article&amp;3=comment_node_article" token="9GNE9u8zi5kS0K1psXJOda3L68jraM_lz9n-Xhp1MW8"></drupal-render-placeholder> </section> Thu, 02 May 2019 12:42:33 +0000 daniel 108 at https://danlobo.co.uk Updating Drupal 8 Minor Version https://danlobo.co.uk/article/updating-drupal-8-minor-version <span property="schema:name">Updating Drupal 8 Minor Version</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2018-09-10T12:18:38+00:00">Mon, 10/09/2018 - 13:18</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>With the latest release from&nbsp;<a href="https://www.drupal.org/project/drupal/releases/8.6.0">Drupal</a>&nbsp;also including the latest security fixes, it was time to update again. One issue that experienced Drupal Developers are probably quite used to by now are the continual stream of security advisories that need to be addressed, especially if you are managing a site that also includes peoples data. This means regularly maintaining your site to ensure it is kept up to date and secure.</p> <p>Having gone through this previously, a word of warning, this can be problematic, so any updates should be done first on a non production environment, to allow you to address any issues that may arise from the update. The best practice of updating drupal has changed with the release of Drupal 8. Previously, before the introduction of composer to handle dependencies, Drupal lived in its own ecosystem and updating was handled really smoothly using a tool like drush. WIth Drupal 8, the recommended ways of handling dependencies is to use <a href="https://getcomposer.org">Composer</a>. Composer falls under a <a href="http://mit vs apache open source license">MIT Licence</a> so is permissive free software licence, and is a great tool for managing php packages on the <a href="https://packagist.org">Packagist</a> repo, much like npm allows you to manage your node js dependencies on their repository. Composer has a minimum requirement of PHP 5.3 and supports various&nbsp;<a href="https://en.wikipedia.org/wiki/PHP_Standard_Recommendation">PHP Standard Recommendation</a>&nbsp;namespaces including the autoloading standard&nbsp;PSR-4 which is the new standard with the launch of D8.</p> <p>When working locally my preference is to use the <a href="https://github.com/wodby/docker4drupal">Wodby Drupal</a> Docker Stack when running Drupal 8. I also have Composer installed on my host. One good thing with Composer is you can choose to run the dependency manager on either the host or guest machine. My preference is to use my host. As composer runs in php, in order to get the best performance, I would highly recommend bumping the memory limit own your host machine. Let's first check what the limit is:</p> <pre> <code class="language-php">php -r "echo ini_get('memory_limit').PHP_EOL;"</code></pre><p>If we need to adjust the limit lets find out where the config file is:</p> <pre> <code>php --ini</code></pre><p>We can then adjust accordingly. To get the optimal experience try setting to -1 (unlimited).</p> <p>Ok, So let's first check&nbsp;what needs updating and this may also flag any issues that need addressing.</p> <pre> <code class="language-bash">composer outdated drupal/* </code></pre><blockquote> <p>The&nbsp;<code>outdated</code>&nbsp;command shows a list of installed packages that have updates available, including their current and latest versions. This is basically an alias for&nbsp;<code>composer show -lo</code>.</p> <p>The color coding is as such:</p> <ul> <li><strong>green (=)</strong>: Dependency is in the latest version and is up to date.</li> <li><strong>yellow (<code>~</code>)</strong>: Dependency has a new version available that includes backwards compatibility breaks according to semver, so upgrade when you can but it may involve work.</li> <li><strong>red (!)</strong>: Dependency has a new version that is semver-compatible and you should upgrade it.</li> </ul> <p><a href="https://getcomposer.org/doc/03-cli.md#outdated">https://getcomposer.org/doc/03-cli.md#outdated</a></p> </blockquote> <p>Provided there are no issues, names space conflicts and the like:</p> <pre> <code class="language-bash">composer update --with-dependencies</code></pre><p>The <code>--with-dependencies</code> flag&nbsp;updates also the dependencies of packages in the argument list, except those which are root requirements.&nbsp;</p> <p>For completeness is is also useful to know how to remove a module with composer</p> <pre> <code class="language-bash">composer remove drupal/pathauto</code></pre><p>If you just want to update a single module the command for this is similar:</p> <pre> <code class="language-bash">composer update drupal/geofield --with-dependencies </code></pre><p>This will update all your dependencies, including those declared in your drupal&nbsp;project's vendor folder. How you manage these is up to you. If you have the benefit of a Jenkins server or similar to help with your deployments, you can probably get away of just checking the composer.lock and composer.json file in to your codebase, along with any custom code or themes, which you will have to figure out how to deploy with the rest of your codebase, and then build the deployment on a production like environment, with a whole bunch of unit tests and integration tests, prior to an actual release. Personally I do not have that luxury, and have decided the easiest way for now is to simply use git to manage the codebase deployment, As long as the php version is the same on my local and production, this has worked for me so far. Using git just simplifies the whole deployment process.</p> <p>So hopefully this all went smoothly and your codebase has been updated. Next you need to update the database, along with any hook_updates that may have come bundled with any new code. There are a couple of ways to do this. On my local environment I am using <a href="https://github.com/Wodby/docker4drupal">Docker for Drupal</a> and also have drush enabled as part of my environment setup. To run this I need to log into the php shell:</p> <pre> <code class="language-bash">docker-compose exec php bash</code></pre><p>From here you can run the following drush command</p> <pre> <code class="language-bash">drush updatedb</code></pre><p>After that you will need to clear the cache. In Drupal 8, as with many other things, there as a new command for clearing all the cache called <em>cache rebuild</em>:</p> <pre> <code class="language-bash">drush cr</code></pre><p>For what ever reason you do not have access to the shell environment, you can also run these from the ui. Firstly go to yoursite/update.php as an admin user and follow the on screen steps to update the database manually. Then navigate to your config&gt;performance page to clear the cache again manually.</p> <p>That's it, job done! Drupal 8 is a product of the fantastic open source community and it is amazing what they have achieved to date. Drupal 8.6 is the first version of Drupal to fully support a migration path from Drupal 7. If you are interested in some of the many great features in Drupal 8 now is as good a time as any to upgrade.</p> <p>&nbsp;</p> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/tags/upgrade" property="schema:about" hreflang="en">Upgrade</a></div> <div class="field--item"><a href="/tags/composer" property="schema:about" hreflang="en">composer</a></div> <div class="field--item"><a href="/taxonomy/term/3" property="schema:about" hreflang="en">PHP</a></div> <div class="field--item"><a href="/tags/namespaces" property="schema:about" hreflang="en">namespaces</a></div> <div class="field--item"><a href="/tags/composer" property="schema:about" hreflang="en">composer</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=95&amp;2=comment_node_article&amp;3=comment_node_article" token="XVye8lknH8jPo6pO5FX9aETlKd-gZy-mFJUXGPCknQA"></drupal-render-placeholder> </section> Mon, 10 Sep 2018 12:18:38 +0000 daniel 95 at https://danlobo.co.uk CSS Reset Module for Drupal https://danlobo.co.uk/article/css-reset-module-drupal <span property="schema:name">CSS Reset Module for Drupal</span> <span rel="schema:author"><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span property="schema:dateCreated" content="2015-02-18T17:27:23+00:00">Wed, 18/02/2015 - 17:27</span> <div property="schema:text" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>I have been using Drupal since 2009 and one of things that is impressive is how modular it is. The core Drupal build is very extensible and there are literally 100's of thousand's of contributed modules out there, many of them regularly updated and maintained by the very active open source Drupal community.</p><p>So it has taken me a while to come up with an idea for a Drupal module that no one else seems to have addressed, the idea of a 'CSS reset'.</p><p>"Ah, but I have one of those in my theme already!" you say. Yes, but the problem is it is called after any css is declared at a system or module layer. So not only is it standardising browser output, it is essentially resetting anything else that has been declared before drupal gets to the theme reset. Hence, the chance are if you are using a reset here, you'll have to rewrite a whole bunch of styles afterwards to reset the reset! I think you'll agree this is is not very efficient so hence the idea of a Drupal module that provides a reset.</p><p>My module is very simple. If allows you to use a css reset of your choice, and makes sure that this is called first, i.e. the css file is weighted to make sure it is called first before any other css is called. This means that the css reset should only reset the browsers as intended and not css that is declared before it gets to the active theme folder.</p><p><a href="https://www.drupal.org/sandbox/2dareis2do/2275019">https://www.drupal.org/sandbox/2dareis2do/2275019</a></p></div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags:</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" property="schema:about" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/tags/css" property="schema:about" hreflang="en">CSS</a></div> <div class="field--item"><a href="/tags/reset" property="schema:about" hreflang="en">reset</a></div> </div> </div> <section> <h2>Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=81&amp;2=comment_node_article&amp;3=comment_node_article" token="eQJo4GQz5iRmIzknlqc8KKfyQVK-jkGxNXtAc-SSXdk"></drupal-render-placeholder> </section> Wed, 18 Feb 2015 17:27:23 +0000 daniel 81 at https://danlobo.co.uk British Council / They Create https://danlobo.co.uk/content/drupal-7-site-building-2012 <span>British Council / They Create</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Multi-Lingual Site Build Drupal 7</p> <p><a href="http://transform.britishcouncil.org.br"><img alt="Transform Project - British Council" data-entity-type="" data-entity-uuid="" src="/sites/default/files/portfolio/transform2b.jpg" /></a></p> <p>Arts and Culture Networking site commissioned by the British Council as part of the Olypic handover from the Uk to Brazil. Drupal 7 multilingual site build. Visitors to the site would be able to filter content by art form, country, city and language. One of the challenges was to incorporate the use of a bespoke isotope style user interface or wall board.</p> <p>&nbsp;</p> </div> <span><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span>Thu, 28/02/2013 - 15:26</span> <div class="field field--name-field-carousel-caption field--type-string field--label-above"> <div class="field--label">Carousel Caption</div> <div class="field--item">Multi-Lingual Site Build Drupal 7</div> </div> <div class="field field--name-field-date-created field--type-datetime field--label-hidden field--item"><time datetime="2012-07-01T00:00:00Z">Sun, 01/07/2012 - 01:00</time> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/tags/site-building" hreflang="en">Site Building</a></div> </div> </div> Thu, 28 Feb 2013 15:26:56 +0000 daniel 58 at https://danlobo.co.uk Human Brain project (HBP) / Illumina https://danlobo.co.uk/content/html-css-css3pie-2012 <span>Human Brain project (HBP) / Illumina</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p>Drupal, CSS, CSS3PIE, CSS Transform, Context Module</p> <p><a href="https://www.humanbrainproject.eu/en/"><img alt="HBP - Human Brain Project" data-entity-type="" data-entity-uuid="" src="/sites/default/files/portfolio/hbp.jpg" /></a></p> <p>Use of Drupal to create prototype for human brain project pitch. Design made heavy use of transparency. I was able to use css3pie in order to support transparency in legacy browsers.</p> <p>&nbsp;</p> </div> <span><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span>Thu, 28/02/2013 - 14:23</span> <div class="field field--name-field-carousel-caption field--type-string field--label-above"> <div class="field--label">Carousel Caption</div> <div class="field--item">Drupal 6, HTML, CSS </div> </div> <div class="field field--name-field-date-created field--type-datetime field--label-hidden field--item"><time datetime="2012-05-01T00:00:00Z">Tue, 01/05/2012 - 01:00</time> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/tags/html" hreflang="en">HTML</a></div> <div class="field--item"><a href="/tags/css" hreflang="en">CSS</a></div> <div class="field--item"><a href="/taxonomy/term/3" hreflang="en">PHP</a></div> </div> </div> Thu, 28 Feb 2013 14:23:40 +0000 daniel 57 at https://danlobo.co.uk NHS / Illumina https://danlobo.co.uk/content/front-end-dev-drupal-6-2012 <span>NHS / Illumina</span> <div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"><p><a href="https://www.nhs.uk"><img alt="Personal Care Planning NHS" data-entity-type="" data-entity-uuid="" src="/sites/default/files/portfolio/pcp_nhs.jpg" /></a></p> <p><img alt="NHS Personal Care Planning" data-entity-type="" data-entity-uuid="" src="/sites/default/files/portfolio/nhs_pcp2_0.jpg" /></p> <p>Worked on implementing approved&nbsp;PSD&nbsp;designs and wireframes into pixel perfect standards compliant semantic html and css incorporated into a Drupal 6 theme or template. Implementations also had to adhere to accessibility guidelines. For this I used a variety of techniques including support for graceful degradation or progressive enhancement. I also used CSS3PIE in order to support CSS3 features on some legacy browsers inclduding support for ie6+.</p> <p><a href="http://www.nhslocal.nhs.uk/page/create-personal-care-plan-online">http://www.nhslocal.nhs.uk/page/create-personal-care-plan-online</a></p> <p><a href="https://careplan.nhslocal.nhs.uk">https://careplan.nhslocal.nhs.uk</a></p> </div> <span><span lang="" about="/users/daniel" typeof="schema:Person" property="schema:name" datatype="">daniel</span></span> <span>Thu, 28/02/2013 - 13:56</span> <div class="field field--name-field-carousel-caption field--type-string field--label-above"> <div class="field--label">Carousel Caption</div> <div class="field--item">XHTML, HTML, CSS, PHP, Theming, Drupal, ie6+, Accessibility</div> </div> <div class="field field--name-field-date-created field--type-datetime field--label-hidden field--item"><time datetime="2012-05-01T00:00:00Z">Tue, 01/05/2012 - 01:00</time> </div> <div class="field field--name-field-tags field--type-entity-reference field--label-above"> <div class="field--label">Tags</div> <div class="field--items"> <div class="field--item"><a href="/tags/drupal" hreflang="en">Drupal</a></div> <div class="field--item"><a href="/tags/front-end" hreflang="en">Front End</a></div> <div class="field--item"><a href="/tags/css" hreflang="en">CSS</a></div> <div class="field--item"><a href="/tags/html" hreflang="en">HTML</a></div> </div> </div> Thu, 28 Feb 2013 13:56:47 +0000 daniel 56 at https://danlobo.co.uk