Occasional thoughts.

Set the default Parent Page and Template in Wordpress using PHP

On a Wordpress site I have users who need to add content to a particular section of the site and nowhere else. To make editing as simple as possible, I want to set the Parent page and Template automatically when users with a certain role are adding a new page. Add these two functions to your theme's...

Shareable with Open Graph and Twitter Cards

When sharing content across social media platforms, Open Graph and Twitter Card Tags (Twitter's extension of Open Graph) can be used to optimize how information is displayed.With Open Graph, you can specify aspects of your Facebook or LinkedIn post such as the title, image, and description. On a...

Conditional Email Recipients with Webform

Building on an earlier post about multiple email recipients, we are now going to see how to add multiple recipients to a single email, when webform is setup to send emails to multiple people. Here is an example setup. Two people within the organization are receiving the email submission and the vi...

Checking the Workbench Moderation State with Rules

Setting up Rules to trigger when a moderation state is changed was not working as expected. I was trying to check the condition for Node: "Content's current moderation state" and "Content's previous moderation state."I want to send an email to certain users when content is moved from Draft to Needs...

Scheduled Publishing with Workbench Moderation and roll based access control

I have been testing different modules, trying to find an intuitive way to schedule posts. There are a couple good ones such as Workbench Scheduler or Scheduler, but they don't fit my use case.I use Workbench Moderation and Access to control user access and assign moderation states to cert...

URL formatting with Regex for Drupal and CKEDITOR

If you list a URL without the protocol and it is processed by the "Convert URLs into links" input filter, "http" will be automatically prepended, regardless of the site being setup for https. Since you don't know what the protocol should be without testing, this is an acceptable fallback. Since the...

Multipe Email Recipients with Webform

Through the Drupal Webform configuration you can specify multiple To addresses but not Cc or Bcc. Webform works by sending a separate email to each To address. For a single email to multiple people, you can add THEME_webform_mail_headers() to your template.php as shown below.You also have access...

allowedContent in Ckeditor

Ckeditor is a very powerful wysiwyg editor, it will however require a bit of configuration to customize.I like giving users the best experience possible but I need to maintain control over the structure of content. ckeditor has a configuration option for dissallowedContent. The documentation pa...

Adding CSS to admin pages in Drupal 7

Sometimes it is necessary to only add css to the administrative areas of a site. In Drupal 7 this can be accomplished with a simple precocess_html. For portability it can easily be made into a module. The code below will look in "/sites/all/themes/your-theme/css/" for admin.css.function admin_css...

Drupal 8 Tips

After a first exploration of Drupal 8, you can tell a lot of thought has been given to its functionality by how much more refined it feels. It takes steps in a different direction than previous versions and that will take some adjustment. Here are some tips that I will add to over time.Module sup...

Dropping Support for Old Browsers

For a long time I have tried to hold onto users who are reluctant or unable to upgrade their browser, at the cost of not supporting modern browsers to the extent that they should be supported. This has been an unfortunate case of certain industries struggling to catch up and still relying on older t...

Drupal Calendar using a Field Collection of Dates

Field Collection is a popular choice for creating a repeatable entity containing multiple fields. Basic setup is fairly straight forward. An additional module is available for Views integration. Even if you use Views regularly, setting the appropriate Relationships and Contextual Filters can be a...

Responsive Font Sizing

For years I have used "font-size: 62.5%" (10px) as my base font size. Text sizing was easy, 1.2em for 12px, 1.8em for 18px. Over time I have seen an increase in overall font size usage. I have been spending considerable time converting a desktop theme to be responsive. By switching to a base font-si...