Sean Reiser

Hi I'm Seán Reiser, this is my Personal Blog

“A person is what they think about all day long”
~Ralph Waldo Emerson

Harry Reid removing the filibuster for judicial appointments is what allowed Trump to get three very conservative justices on the Supreme Court. Removing the filibuster just to get legislation passed, it's only a good strategy if you plan to never lose an election. Where the filibuster prevents a slim liberal majority in the Senate from passing some legislation, it also prevents the conservatives from passing legislation when they have a slim majority.  I worry about passing legislation on 51 vote majorities, without some form of consensus laws  can swing back-and-forth depending upon who is in control.

The reason I prefer codifying rights in the Constitution, is because it's harder to do. If something is hard to do it is equally hard to undo. Yes it is more work to get privacy added to the constitution, but it would be enduring. Passing a law when one side of the other has a slight majority in both houses is easy which leads to inconsistency.

Of course what's worse is enforcing rules by executive fiat. Whether it's by executive order, or by rules enacted by an administrative department, these rules can be changed at the whim of one person.

I still contend that these major questions of rights for citizens and residents of this country should be codified in the Constitution and that a Constitutional Convention of States is important that the structure.



Lunchtime Learning
Editor Experiences and a Ham Sandwich

Making Drupal Friendly for Editors and Clients   Drupaldelphia 2019


Configuring Drupal 9 to use the SMTP module with iCloud+'s custom domains

When Google announced it was going to shut down its legacy free email for domains, I decided to  use iCloud+ to manage the mail from since I was paying for it anyway. I set it up but it's been working fine as a mail server. I had been running sendmail off my web server to send mail from my site when I needed to. In order to avoid spam folders,I decided to move to using SMTP, which meant I needed to authenticate to Apple's SMTP Server.

At first, I had a problem authenticating, until I realized that your email addresses at your custom domain is an aliase, so you need to authenticate with your iCloud account and an App-Specific Password. I'm using Drupal 9;s SMTP Authentication Support  Module.  Here are the parameters I used on /admin/config/system/smtp:

SMTP server settings
  • Enable TLS encryption automatically - On
  • Turn on the SMTP keep alive feature - Off
SMTP Authentication
  • App-Specific Password.
E-mail options
  • Allow to send e-mails formatted as HTML - up to your use case

Everything else leave as is. I'd do a test with debugging turned on and then turn it off. I also used the mail system module to redirect all mail to SMTP.

Good luck, Share and  enjoy!



Laptop w/ Stickers


Lunchtime Learning
Caching and a Ham Sandwich

Understanding Drupal's Cache API: Lightning Speed with Low Effort,   Drupaldelphia 2019


 As I watch the news I wonder how the 3/5 compromise is taught in school today. It is often said that the founders who implemented the 3/5 compromise did so because they believed an African-American is worth 3/5 of a white man. This is really not the case. The compromise was a tool used by abolitionists to limit the power of the south. If slaves were counted the same as freemen, the south would've had more political power and been able to expand slavery. In reality, the south wanted slaves to be counted the same as three people, and the north wanted to be counted as none, hence the compromise.

Somehow over the last couple weeks, ace.js broke on this site, so a number of my coat samples look broken. Lunchtime learning has been replaced today by fixing ace.js. Back to normal tomorrow.  I want to switch to CKeditor's code snippet module, anyway. This is as good a reason as any

Laptop w/ Stickers

Creating a Bookmarklet To Save a Link With Metadata In Drupal 9

This site has a linkblog and I thought I'd do a quick writeup on how I capture the links and their metadata.  You'll notice the the links are displayed in cards, similar to what you see on social media sites such as Facebook and Twitter.

This writeup will cover:

  1. The conten type to store a link and its metadata,
  2. Creating a bookmarklet so you can easily add a story to your site as you surf the web.
  3. Scraping metadata on a webpage to get the image, site name, title and description.

This writeup assumes that you have some basic understanding of Drupal on a site builder level.  I'm assuming you understand basic administration tasks such as creating content types, and fields as well as how to create a module,.  

Although I wrote the code for Drupal 9, as I review it, I see no reason that it won't work for Drupal 8.   Since support is ending for Drupal 8, you should be upgrading to Drupal 9, but that's a different matter.

Creating The Content Type

You'll need a content type to house the links.  On this site I'm using my generic note type which I use for most of my blog posts (this allows me to add a link to any post).  But I assume you want to use a separate content type, let's create a content type named link.  In addition to the standard title and body fields you want to give it the following fields::


Field Name

Field Type




OG Link Description


Text (plain, long)

OG Link Image Url


Text (plain, long)

OG Link Site Name


Text (plain)

OG Link Title


Text (plain)



Text (plain, long

HTTP Status Code


Text (plain, long)


Of course you can just add these fields to an existing content type as I did, you'll just need to adjust the code as you go forward.

Building the Bookmarklet

Simply put, a bookmarklet is a browser bookmark that contains JavaScript.  We're going to create one that will open a node add form with the url of the current page already prepopulated into the link field.  This saves you the effort of copying the current URL, opening your site, navigating to the node add form and pasting in the url of the page you want to blog.  There are 2 things we need ti do to make this work:

First we'll  get Drupal to accept a parameter on the node add form's URL and prepopulate the link field.  We either need to create a new module or use a module that you already use for glue code and use hook_form_alter.

use Drupal\Core\Form\FormStateInterface;
Use Drupal\Core\Routing;

 * Implements hook_form_alter().
function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // Adding custom validation for the welcome page type field.
  if ($form_id == 'node_link_form') {
  	 $form['field_link']['widget'][0]['uri']['#default_value'] = \Drupal::request()->query->get('link');

This code basically says, "when loading the node add page for the link content type, look to see if there is a 'link' query string, and if there is, put the contents of the query string into field_link."

Next we need to get the query string into the URL .... that's where the bookmarket comes into play.  Here's a little javascript

javascript:(function(){var url=document.location.href;var uri=""+url;,"_blank");}());

You need to replace "" with your site's URL.  Just add a bookmark in your browser, call it something like "Add Link To My Site" and paste the javascript in as the link.  Add the bookmark to the favorites bar and when you're on a page that you want to blog about, click on the button, add any commentary in the body field and rock and roll.

There is a contributed module, Prepopulate which accomplishes the sane thing (and more) but is a little more overhead than the couple of lines of code I wrote here.  Plus, if we use contrib for the easy things, we'll never learn anything.

Fetching Metadata

Next we need to fetch the image url, site name, title and description.   You can either scrape the content for metadata server side at save or client side at when rendering the page.  I prefer doing it at save since doing it  doing it at client side will slow down page loads.  Of course, since you're caching the information, if the site changes any of the metadata, your site will be out of date.

Instead of writing code to parse out the metadata, I took advantage of opengraph.php, a library that does the heavy lifting,  Very simply, I used hook_ENTITY_TYPE_presave to populate the appropriate fields.  You can put this in the same module from above:


function mymodule_node_presave(Drupal\Core\Entity\EntityInterface $entity){
  if ($entity->bundle() == "link") {		    
    $link_url = $entity->get('field_link')->uri;	    
    if (($link_url) && !($entity->field_http_status_code->getValue())){   
      $headers = get_headers($link_url, 1);
      $og_data = OpenGraph::fetch($link_url);
      $entity->field_og_link_site_name->value = $og_data->site_name;
      $entity->field_og_link_description->value = $og_data->description;
      $entity->field_og_link_image_url->value = $og_data->image;
      $entity->field_og_link_title->value = $og_data->title;
      $entity->field_og_link_url->value = $og_data->url;
      $entity->field_http_status_code = var_export($headers,1);

This loads the open graph library, loads the page info a variable and pass the page to the library to find the  metadata and then add it to the node before it's saved.



Laptop w/ Stickers


Lunchtime Learning
Paragraph Layouts and a Ham Sandwich

Build Highly Visual Long Form Content With Layout Paragraphs,   DrupalCon Portland 2022

 I've been partially offline of the last few days fighting a migraine. A lot is going on in the world and I got a bunch of mixed feelings when it comes to it. Generally speaking, I prefer a smaller Federal Government I prefer it to do less, I prefer that the roles and responsibilities of the Federal Government are laid out in the Constitution, just so the government can't arbitrarily create powers for itself. I want power to be at a State or local level. The closer the power is to me, the more likely I am to influence it.  I look to the Supreme Court as umpires, people who basically call balls and strikes. Is the Government allowed to do this? Is the Government restricted from doing that?

In the past when the topics of abortion and guns have come up, I've always taken the opinion that people who want to create laws around them should be amending the Constitution. If you what to add restrictions to guns, that's fine, we need to give Congress the ability to do so in a way we will know the extent of their powers.  Since nothing of healthcare is mentioned in the Constitution, if we want the Government to be involved in regulating any sort of healthcare, whether it's abortion or whether it's insurance, we need to amend the Constitution to allow the Federal Government to be involved in it.  The Supreme Court was right from a balls and strikes POV but there is a check on the Supreme Court, the People.....

For a long while I felt we needed a bit of a Constitutional Reboot. The founders gave us a tool for this, a Convention of States. The purpose of the convention would be to propose and ratify new amendments to the Constitution. We probably needed this for the better part of 150 years since the end of the Civil War.