<?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 Joeri Poesen on Medium]]></title>
        <description><![CDATA[Stories by Joeri Poesen on Medium]]></description>
        <link>https://medium.com/@jpoesen?source=rss-b059b1d6e8b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FdWWw0Gg5JNuX_oZeQZRTg.jpeg</url>
            <title>Stories by Joeri Poesen on Medium</title>
            <link>https://medium.com/@jpoesen?source=rss-b059b1d6e8b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 22:03:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jpoesen/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[Announcing Pathway Education, Drupal Training with a Heart]]></title>
            <link>https://medium.com/@jpoesen/announcing-pathway-education-drupal-training-with-a-heart-3a3212bef59f?source=rss-b059b1d6e8b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a3212bef59f</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[training]]></category>
            <category><![CDATA[training-courses]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Joeri Poesen]]></dc:creator>
            <pubDate>Mon, 29 Oct 2018 18:47:59 GMT</pubDate>
            <atom:updated>2018-10-29T18:47:59.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_2gTaO7v2PRrFNcG" /><figcaption>“woman and man sitting in front of monitor” by <a href="https://unsplash.com/@nesabymakers?utm_source=medium&amp;utm_medium=referral">NESA by Makers</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>After running Code Enigma’s Drupal training services for the best part of five delightful years, I’m leaving the nest to kick off <a href="https://pathwayeducation.eu/">Pathway Education</a>, a startup dedicated to open source technology training and educational tools.</p><p>The Code Enigma team has been wonderful to work with, and our relationship isn’t actually ending, as Pathway Education will be Code Enigma’s preferred training partner.</p><p><strong>So why this change?</strong></p><p>Our initial focus is on <strong>Drupal</strong>, but the Pathway team has ambitions beyond this. We want to help people understand and master an array of tools and technologies. We have a specific vision on how to do this, and the tools and processes to achieve this.</p><p>We’re currently offering public and private training, and we’re busy building a set of complementary products and services.</p><p>We think there’s a better approach to technical training and this requires time and investment. It complements and extends Code Enigma’s focus on designing, building, hosting, and supporting complex Drupal projects. They’re deliberate with their time and who they choose to work with, and I’m determined our team will be the same.</p><p>We’d like you to join us in London for three workshops we’re running in December. It’s a great opportunity as the year comes to a close to refresh your skills (and if you’re seeking something useful to spend your remaining training budget on before the New Year).</p><p>For more information and booking, follow the links to the workshops:</p><p><a href="https://pathwayeducation.eu/drupal-training/drupal-8-core-concepts-london-december-2018"><strong>Drupal 8 Core Concepts</strong></a><br> Monday December 17<br> €350 (excluding VAT)</p><p><a href="https://pathwayeducation.eu/drupal-training/drupal-8-content-editors-london-december-2018"><strong>Drupal 8 for Content Editors</strong></a><br> Tuesday December 18 — Wednesday 19 (two day workshop)<br> €700 (excluding VAT)</p><p><a href="https://pathwayeducation.eu/drupal-training/drupal-8-site-builders-london-december-2018"><strong>Drupal 8 for Site Builders</strong></a><br> Thursday December 20 — Friday 21 (two day workshop)<br> €700 (excluding VAT)</p><p>Onward and upward!</p><p>Here’s where to find us:</p><ul><li>web: <a href="https://pathwayeducation.eu/">https://pathwayeducation.eu</a></li><li>twitter: <a href="https://twitter.com/PathwayHQ">https://twitter.com/PathwayHQ</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*rnnU7DXLF_AQaFochxEobQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a3212bef59f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Drupal 8 Entity Validation]]></title>
            <link>https://medium.com/code-enigma/introduction-to-drupal-8-entity-validation-f0aa37c1f9a3?source=rss-b059b1d6e8b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0aa37c1f9a3</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[drupal]]></category>
            <dc:creator><![CDATA[Joeri Poesen]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 07:27:41 GMT</pubDate>
            <atom:updated>2018-07-23T07:54:07.972Z</atom:updated>
            <content:encoded><![CDATA[<p>Entity validation refers to specifying criteria (<em>constraints</em>) which must be met before an entity can be saved (created or updated).</p><p>A traditional way to do this in Drupal has been to implement <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21form.api.php/function/hook_form_alter/8.5.x">hook_form_alter()</a> and add a custom <a href="https://www.drupal.org/docs/8/api/form-api/introduction-to-form-api">form validation handler</a> to the entity creation form — usually the node edit form.</p><p>Custom validation handlers are a perfectly good option, but their drawback is that your custom validation will only happen when entities are created via the entity creation form; validation will not happen when entities are created/updated via any other mechanism: data migration, creation via REST or JSON API web service, custom code snippets, ...</p><p>To ensure custom entity validation happens regardless of the method of creation, use the <a href="https://www.drupal.org/docs/8/api/entity-validation-api">Entity Validation API</a>.</p><h3>Specifying constraints</h3><p>Validation criteria are called <strong><em>constraints</em></strong> in the Entity Validation API. Each individual constraint is a <em>Plugin</em> and consists of a <em>constraint </em>and a <em>constraint validator.</em></p><p>You must do three things:</p><ol><li>Create a new constraint.</li><li>Create a matching constraint validator.</li><li>Attach the constraint to the entity type as a whole, or to a specific field of the entity.</li></ol><p>For now we’ll keep things simple and add a constraint to an entity type as a whole, not to a specific field.</p><p>This example is a simplified version of the <em>ArticleLimitConstraint </em>you find in the sample code repository at <a href="https://github.com/codeenigma/entity-validation-examples">https://github.com/codeenigma/entity-validation-examples</a>. Be sure to open it alongside to this article to understand the structure of the Plugin and to see which files go where.</p><p><strong>Step 1: Make your new constraint known to Drupal</strong></p><p>Create a class for your constraint. Notice that the docblock contains an annotation that provides crucial information:</p><ul><li><em>id</em>: the unique name you choose for your constraint</li><li><em>label</em>: your constraint’s description</li><li><em>type</em>: the type of constraint. In this case we’re acting on entities.</li></ul><pre><strong>use </strong>Symfony\Component\Validator\Constraint;<br><br><em>/**<br> * Description here.<br> *<br> * </em><strong><em>@Constraint</em></strong><em>(<br> *   id = &quot;DemoFirstConstraint&quot;,<br> *   label = </em><strong><em>@Translation</em></strong><em>(&quot;Description here&quot;, context=&quot;Validation&quot;),<br> *   type = &quot;entity&quot;<br> * )<br> */<br></em><strong>class </strong>DemoConstraint <strong>extends </strong>Constraint {<br><br>  <em>/**<br>   * Message shown when validation fails.<br>   *<br>   * </em><strong><em>@var </em></strong><em>string<br>   */<br>  </em><strong>public </strong>$message = &#39;Node creation failed: reason-goes-here.&#39;;<br><em><br></em>}</pre><p><strong>Step 2: Write your validation logic</strong></p><p>Your actual validation logic goes in a ConstraintValidator class. Mind the naming convention: if your constraint is named <em>DemoConstraint</em>, your constraint validator has to be named <em>DemoConstraintValidator</em>.</p><p>You can write arbitrary validation logic here. When you decide certain criteria aren’t met, and validation should fail, use the <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21TypedData%21Validation%21ConstraintViolationBuilder.php/function/ConstraintViolationBuilder%3A%3AaddViolation/8.5.x">addViolation()</a> method and pass along the message to display to the end user:</p><pre><strong>use</strong> Symfony\Component\Validator\Constraint;<br><strong>use</strong> Symfony\Component\Validator\ConstraintValidator;</pre><pre><strong>class </strong>DemoConstraintValidator <strong>extends </strong>ConstraintValidator {<br><br>  <em>/**<br>   * {</em><strong><em>@inheritdoc</em></strong><em>}<br>   */<br>  </em><strong>public function </strong>validate($entity, Constraint $constraint) {<br>    <strong>if </strong>(!<strong>isset</strong>($entity)) {<br>      <strong>return</strong>;<br>    }<br><br>    // TODO: Write your actual validation here.</pre><pre>    <strong>if </strong>($some_condition == TRUE) {<br>      $this-&gt;context-&gt;addViolation($constraint-&gt;message);<br>    }<br>  }<br>}a</pre><p><strong>Step 3: Attach your constraint to the entity type</strong></p><p>In our example we want the validation to happen on entities of the type <em>node</em>, so we need to change the node entity type’s definition and use the <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityType.php/function/EntityType%3A%3AaddConstraint/8.5.x">addConstraint()</a> method:</p><pre><em>/**<br> * Implements hook_entity_type_alter().<br> */<br></em><strong>function </strong>demo_entity_type_alter(<strong>array </strong>&amp;$entity_types) {<br><br>  <em>/** </em><strong><em>@var </em></strong><em>$entity_types \Drupal\Core\Entity\EntityTypeInterface[] */<br><br>  </em>$entity = $entity_types[&#39;node&#39;];<br>  $entity-&gt;addConstraint(&#39;DemoConstraint&#39;);<br>}</pre><p>That’s it. Put the code in a module and enable it. When modifying these classes don’t forget to clear your caches if things don’t seem to be working.</p><p>If all went well you should get an error message every time you try to create or update a node and your code has triggered a violation.</p><p>Have a look at the provided sample code. The <em>ArticleLimitConstraint</em> example shows how to limit the creation of article nodes to an arbitrary number.</p><p>In a later article we’ll look at validating field values, and more complex things you can do with constraints.</p><p>Additional resources:</p><ul><li><a href="https://www.drupal.org/docs/8/api/entity-validation-api">https://www.drupal.org/docs/8/api/entity-validation-api</a></li><li><a href="https://github.com/codeenigma/entity-validation-examples">https://github.com/codeenigma/entity-validation-examples</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0aa37c1f9a3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/code-enigma/introduction-to-drupal-8-entity-validation-f0aa37c1f9a3">Introduction to Drupal 8 Entity Validation</a> was originally published in <a href="https://medium.com/code-enigma">Code Enigma</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>