<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>twig</title><description/><link>https://kevinquillen.com</link><language>en</language><item><title>Overriding Output for Search API Fields in Views</title><link>https://kevinquillen.com/overriding-output-search-api-fields-views</link><guid isPermaLink="false">285 at https://kevinquillen.com</guid><description>
&lt;span property=&quot;schema:name&quot;&gt;Overriding Output for Search API Fields in Views&lt;/span&gt;

            &lt;div property=&quot;schema:text&quot; class=&quot;text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item&quot;&gt;&lt;p&gt;Just wanted to share a quick example of overriding a field output from Search API if the value isn’t exactly what you want.&lt;/p&gt;

&lt;p&gt;In my case, I am indexing the URI of a node and have a design requirement to output it as a link in the result, but it has to contain the host and scheme (http://www.example.com/path/to/node). Out of the box, Search API is only returning the “/path/to/node” portion, which QA quickly kicked back to me.&lt;/p&gt;&lt;/div&gt;
      
&lt;span rel=&quot;schema:author&quot;&gt;&lt;span lang about=&quot;https://kevinquillen.com/user/1&quot; typeof=&quot;schema:Person&quot; property=&quot;schema:name&quot; datatype&gt;Kevin&lt;/span&gt;&lt;/span&gt;

&lt;span property=&quot;schema:dateCreated&quot; content=&quot;2017-02-02T12:00:00+00:00&quot;&gt;&lt;time datetime=&quot;2017-02-02T07:00:00-05:00&quot; title=&quot;Thursday, February 2, 2017 - 07:00&quot;&gt;February 2nd, 2017&lt;/time&gt;
&lt;/span&gt;
</description><pubDate>Thu, 02 Feb 2017 12:00:00 GMT</pubDate><dc:creator>Kevin</dc:creator></item><item><title>Adding Twig Template Suggestions for Form Elements</title><link>https://kevinquillen.com/adding-twig-template-suggestions-form-elements</link><guid isPermaLink="false">286 at https://kevinquillen.com</guid><description>
&lt;span property=&quot;schema:name&quot;&gt;Adding Twig Template Suggestions for Form Elements&lt;/span&gt;

            &lt;div property=&quot;schema:text&quot; class=&quot;text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item&quot;&gt;&lt;p&gt;Last week, I had to solve a problem where a prototyped form contained a button element and svg icon for the submit button on three search forms.&lt;/p&gt;

&lt;p&gt;While you can change the type of a input from &lt;code class=&quot;highlighter-rouge&quot;&gt;submit&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;button&lt;/code&gt; in Drupal 8, that does not change the tag the form element uses.&lt;/p&gt;

&lt;p&gt;I needed a clean solution that allowed me to provide the markup and svg icon without interfering with the function of the form itself.&lt;/p&gt;

&lt;p&gt;Here is the output I needed to achieve:&lt;/p&gt;&lt;/div&gt;
      
&lt;span rel=&quot;schema:author&quot;&gt;&lt;span lang about=&quot;https://kevinquillen.com/user/1&quot; typeof=&quot;schema:Person&quot; property=&quot;schema:name&quot; datatype&gt;Kevin&lt;/span&gt;&lt;/span&gt;

&lt;span property=&quot;schema:dateCreated&quot; content=&quot;2017-01-28T12:00:00+00:00&quot;&gt;&lt;time datetime=&quot;2017-01-28T07:00:00-05:00&quot; title=&quot;Saturday, January 28, 2017 - 07:00&quot;&gt;January 28th, 2017&lt;/time&gt;
&lt;/span&gt;
</description><pubDate>Sat, 28 Jan 2017 12:00:00 GMT</pubDate><dc:creator>Kevin</dc:creator></item><item><title>Quick Drupal 8 Theming Tips</title><link>https://kevinquillen.com/quick-drupal-8-theming-tips</link><guid isPermaLink="false">289 at https://kevinquillen.com</guid><description>
&lt;span property=&quot;schema:name&quot;&gt;Quick Drupal 8 Theming Tips&lt;/span&gt;

            &lt;div property=&quot;schema:text&quot; class=&quot;text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item&quot;&gt;&lt;p&gt;If you are theming an entity (in this case, node) and you want to display the created or changed date in a different format, you can use the following to do just that. In my case, I am creating a couple of view modes with their respective twig templates and need to show post dates in a few different formats.&lt;/p&gt;

&lt;p&gt;Use &lt;code class=&quot;highlighter-rouge&quot;&gt;getCreatedTime&lt;/code&gt; to fetch the node created date, and use &lt;code class=&quot;highlighter-rouge&quot;&gt;format_date&lt;/code&gt; against it, supplying a date format machine name:&lt;/p&gt;&lt;/div&gt;
      
&lt;span rel=&quot;schema:author&quot;&gt;&lt;span lang about=&quot;https://kevinquillen.com/user/1&quot; typeof=&quot;schema:Person&quot; property=&quot;schema:name&quot; datatype&gt;Kevin&lt;/span&gt;&lt;/span&gt;

&lt;span property=&quot;schema:dateCreated&quot; content=&quot;2017-01-13T12:00:00+00:00&quot;&gt;&lt;time datetime=&quot;2017-01-13T07:00:00-05:00&quot; title=&quot;Friday, January 13, 2017 - 07:00&quot;&gt;January 13th, 2017&lt;/time&gt;
&lt;/span&gt;
</description><pubDate>Fri, 13 Jan 2017 12:00:00 GMT</pubDate><dc:creator>Kevin</dc:creator></item></channel></rss>