Monthly Archives: February 2015

Context vs Views for site navigation

Originally I was going to use Context to set all the section navigation. But this last week worth of doing automagical things with Views and Taxonomy has got me thinking that maybe even the navigation can be set via a View. And the pages that show up as navigation options, that list in the term’s field can also be set by a View.

(Show all nodes with term X as options to pick in the navigation, basically.)

VIEWS ALL THE THINGS.

(And then it’ll be easy for whomever on our team to create all the basic settings for a site section, all in one place.)

Ditto with site title

Originally, I was including the Site Section name via Field as Block (which is pretty cool!), but it links to the taxonomy term, which is definitely not what I want.

So I added to the view I described in my previous post, with another block including the taxonomy term name, and an entity (node) set as a field in the term.

The tricky bit with this is getting the link right, and I may not have it down perfectly yet.

For the Section Home Page field in the view, I chose Entity ID for the formatter, but also had to make sure to Remove whitespace (under Rewrite Results) to get the NID correctly for turning into a URL in a Custom text field.

Tricksy background image thing

So on our current site, each section has a “background” image; it’s an actual img tag, but it looks background-y.

I’m using Taxonomy to set the site sections, incorporated with Workbench Access. Generally speaking, we don’t want our editors to update this image themselves. (boy howdy no.) So the image is a field on the Taxonomy itself.

To get the right image on the right sections, I’m using a View to tie things together.

  1. The view is a block of content with fields.
  2. To display the actual image, you have to set up a Relationship to the correct taxonomy vocabulary. Then add the image field to the view and delete the Title or any other fields.
  3. To display the right image, you also have to add a Contextual Filter, Content Nid with the default value of Content from URL.

Then it just works. ๐Ÿ™‚

Media + CKEditor

  1. Install & enable Media (1.4 works fine) and CKEditor.
  2. Configure CKEditor:
    1. Go into each profile that should have access.
    2. Go to Editor Appearance.
    3. Make sure “Plugin for inserting images from Drupal media module” is checked.
    4. Remove the Image button from the current toolbar.
    5. Add the Media button to the current toolbar. (It looks like the Image button, but as if the little pictures were stacked!)
    6. Go to Advanced Content Filter.
    7. Add “img[*]” (w/out quotes) to the Extra allowed content box. (Probably you could narrow down the attributes in the brackets, but I’m just going with * for the time being.)

Then: ta-da! It just works. (Assuming that your site has been set up with permissions for uploading via Media module, which is a whole other story.)