There's a neat little Drupal module called JSON Field and recently, I had a chance to play around with it. Out of the box, JSON field is a just a plain field where JSON data can be input and output on a web page.
I've been building Drupal 8 sites with Layout Builder and one feature that I think is missing is the ability to group specific fields inside a wrapper for enhanced theming; a layout within a layout if you will.
Over the past month, I have been working on a large scale Drupal 8 build that is leveraging the Layout Builder module for much of the site's displays. If you have not used Layout Builder yet for a project and have been wanting to jump in, I hope this article will serve as a good overview.
For the past seven months, I've been designing, building, and theming with Drupal 8 for my own side project. Along the way, I've seen huge advancements in these realms versus what was possible with Drupal 7.
In Drupal 8, there's templates for just about anything and with Drupal 8's new theme hooks, you can really narrow in on crafting a custom template for your specific use case. This makes getting at and altering markup far more accessible than it was in Drupal 6 and 7.
I'm currently working on a Drupal build where I'd like users to be able to easily add icons to menu items through the UI. Enter FontAwesome, the scalable vector icon font that leverages the power of CSS. That in combo with the infamous Menu Attributes module allows users to add custom classes to Drupal menu items via the Menu edit interface on a per menu item basis. This is ideal for what we need to accomplish.
In my last article I demonstrated how to extract basic data from field array elements which is ideal for custom node theming. The key to this is using *field_get_items*. I'll expand upon that by adding in additional Drupal API functions to enhance and format these Field array elements.
In this article, I'll show how to really dig into data associated with a field and for that I'll use a preprocess function in your theme's template.php for the logic and then a variable for presentation in a custom node template.
I was recently tasked with theming a customized user login page in Drupal 7. I could not find a whole lot of documentation for this so the first place I looked was in the core modules folder hoping to find something like user--login.tpl.php that I would be able to copy and put in my theme folder for an override.
The Drupal 7 Account pages (user, user/register, user/password), all have the same Title, i.e. "User Account". I just ran up against this issue and my client wanted different / custom titles on these pages.
I often see posts on the drupal.org forums and elsewhere in regard to implementing jQuery scripts and code into Drupal. It seems common that users try to attach JQuery right within page.tpl.php or html.tpl.php. In other words, it's hard-coding a script into a page and it's not ideal. Some try to render it using the PHP filter within a block or node.
In my last blog post I showed how to theme a node post date. I'll take it one step further this time and show how to do the same thing with a View. This assumes you are using the Views Module, and a use case would be if you want to display a feed of items with titles and teasers such as blog posts or news.
As a Drupal themers / front end developers, we are always asked to push the envelope of what's possible with design and theming. With Drupal 6, custom block regions are usually added in page.tpl.php which is normally outside of the actual page node content / comments. It would be above, below content or in sidebars typically.
Ask 10 Drupal Themers how they would accomplish a task in Drupal and you just might get 10 different answers. Most likely those 10 different ways of accomplishing the task would all be valid and unique. This concept would apply when theming a home page element in Drupal; there are several different ways of going about this.
I love it when we discover one of those wonderful Drupal gems that is not well documented and is very powerful in creating some nice Drupal Views theme customization. We were recently tasked with creating an events calendar that has a custom CCK field called "City". There's a drop down menu with a list of cities to assign the event to.
I recently developed a Drupal site where each page in the site was based on a custom content type and needed some very specific theming. Although my custom theme was based on 960.gs, I decided to borrow from the zen theme its custom body class implementation to give more meaningful CSS classes to leverage for theming.
When I was theming my blog in Drupal, I decided I wanted a better way to customize and display post info such as wording used and the way date was displayed. The first step is to have a look around and see where the code is coming from that renders this info. I viewed the files in my custom theme folder and discovered these few lines of code in node.tpl.php