No, dear readers, this isn’t a tale of a sunken initiative with a payload that threatens the rest of core, though darn, that would’ve been good! This is a tale that I hope will entertain those already moist in Drupal droplets, while informing the dry newbies among us.
It is a megillah of mishigas1 seemingly immune to the eroding currents of entropy. It begins on a cold November day, with yours truly staring at the home page of a mature Drupal site belonging to a newly acquired client. And there it was, by all appearances innocuous, except that it stared out at me from the center of the page, like a hibiscus in a field of Dusty Miller.
OCTOBER
It was this errant text I needed to exile from the page. You know the backstory: some other developer created the site and, for whatever reason, was no longer contactable. So it was up to me to discover the provenance of the chartreuse OCTOBER.
On a raw website, it would typically be a simple exercise, but this is Drupal. The first lesson of any architecture that embraces abstraction and extensibility is that these things tend to flow downstream. It’s easy to find your way to the mouth of a river, but finding its source is something else entirely.
If you want a quick solution to a mystery, often the best place to begin is at the end. That would be the page source, which is sometimes more accurate than an inspection of the item, because browser tools often do some cleanup. Drupal has a reputation for piling on div’s like layers in a lasagna. A benefit to this is that frequently one of the div tags will contain a class name that reveals its source. In this case the div tag contained no useful information, nor did the h1 tag.
On to the browser tools and, in particular, the CSS settings, because something is making the text chartreuse, and the name of the CSS file containing the rule could provide the answer I need. But no such luck. The CSS is inline, and is not from a rule contained in a style file.
So, what next? The text could very well be coming from a module or template file. In that case, a grep (global search) of the code base could find the source, if it is a literal, like:
print ‘OCTOBER’;
It is not. Though there are almost three dozen occurrences of the string, none help me. Of course, there is also the possibility that it is coming from a request to format a date using only the month name, which would make it nigh impossible to find, as would be the case if it were coming from a call to a service from within the PHP code. There are still some possibilities to check before tossing in the towel.
If it’s not in the code, which is the assumption I’ll make for now, then likely it’s in the database, and the first stop for database content is, well, Content. This site has been around for a while, so there is a wealth of content. However, in looking at the content that is used as such on the front page, none of it is the culprit; nary a node containing ‘OCTOBER.’ There is another possibility: a piece of content contains a PHP string that results in rendering the month name. But in looking at the nodes that make up the front page, none use embedded PHP. I can dump the database, and search the dump for ‘OCTOBER,’ but I’ll save that as a last resort.
Which type of content is most prevalent on a Drupal site and most prevalent in the hot debates of the past few years? Blocks. And no, none of the blocks are the purveyor of ‘OCTOBER.’ The next question is: does the site use Panels, here, there or anywhere? Fortunately the answer is “no,” because that would take me way above my word limit.
Like any good mystery, the protagonist (that would be moi) needs an opportunity to stumble upon a clue. And if there’s anything I’m a champ at, it’s stumbling. Yet, even I see the occasional blinding flash of the obvious.
In seeking a cause, when all else fails, make the rest fail.
I turned off JavaScript, and low and behold: chartreuse OCTOBER disappeared from the sonar screen. I was happier than Spongebob in a field of krab. Some further digging into the JavaScript being loaded on the page revealed that the text was being supplied from offsite.
A simple fix.
1 A long tale of craziness; a FORTRAN term, or perhaps Yiddish?