Variants and Node Add/Edit Overrides

Variants in Drupal allow you to reuse Panel Page layouts to make your life easier. You use Selection Rules to allow the system to decide what variant to use based on any number of criteria. In my case, I use Variants on the node add/edit form to provide a consistent interface between several different content types. As with many things Drupal, there are a few idiosyncrasies.

I have a custom content type called member-galleries. This holds images in a gallery like display. To render the add node properly, I had to learn the hard way that using

Image

the “Node Being Edited: Gallery Image form” is not the correct form to use. Even though Gallery Image is the field name that I gave the Image field on the content type that I created. It just seemed to make sense, right? And even worse, it appears when you test the functionality that this is the way to go. But, I kept getting a red herring error about file size when I would try to save an image. It turned out that the Variant really needed the “Node Being Edited” Base form instead. It appears to be exactly the same until you try to save a node of the content type.

Advertisements

Additional Drupal Search Resources

I am really surprised at the dearth of documentation on Search options/modules on Drupal.org. So I am compiling a running list of different sites that have actual details on what you can do with Search and how best to achieve them.

https://drupal.org/node/343467 – Probably the best place for docs on Solr and Drupal, and all the mods that go with them.

http://envisioninteractive.com/drupal/drupal-7-views-with-faceted-filters-without-apachesolr/ – Great one for those who want to use the out-of-the-box search_db backend.

http://www.acquia.com/blog/simple-guide-install-apache-solr-3x-drupal-7 – One for Solr – which I believe I am going to end up using.

http://www.lullabot.com/blog/article/installing-solr-use-drupal – Installing Solr. GREAT TUTORIAL from LULLABOT

http://xmodulo.com/2013/02/how-to-install-apache-tomcat-on-centos.html – installing apache tomcat for Solr on Centos

http://www.mkyong.com/tomcat/how-to-check-tomcat-version-installed/ – Tomcat version

http://quark.humbug.org.au/publications/notes/bofh/msg00027.html – tomcat authentication

http://wiki.apache.org/solr/SolrTomcat – troubleshooting Solr

http://zugec.com/73-how-setup-search-api-apache-solr – installing solr and drupal info

create many nodes from one upload

If you ever need to upload a bunch of images and you want to be able to deal with them as separate nodes, the bulk media bulk media upload mod is for you. all of the nodes below were created in one simple upload. the mods use tokens for replacement patterns for the titles so that you have a lot of simplicity in regards to the naming of the nodes. this is a great way to get a lot of work done quickly.

Bulk Media Upload 7.x-1.x-dev With Bulk Media Upload you can upload a bunch of media files and a new node will be created for every file.

Requires: Entity API (enabled), Plupload integration module (enabled), Token (enabled)
Help Pe

Image

Taxonomy Comparisons

I have been neck deep in Taxonomy, OG, Rules, Contexts, Relationships and many more all week. It hasn’t been very fun but I know that I need to be able to scale this site properly and so, I need to do the research early on.

I need to be able to sort all site content by geography. Specifically by the state that the member resides in. The member will always have only one state. What I really need it a way to autotag a node (as it is being authored) with the state that the member resides in. Here is a really good wiki from drupal.org with a run down of many of the options available.

https://groups.drupal.org/node/38290

For my case, it appears that I will be able to use the Rules module and Roles (a core user function) to acheive this. Here is a link to a post that helped me arrive at this decision.

http://stackoverflow.com/questions/11588523/assign-drupal-tags-automatically

Gallery Formatter Module

I have been struggling for days to get an image gallery solution that will work for me and I think that I am just about there. Gallery Formatter is the latest piece of the puzzle. This post is a WIP, so here are a few bare bones details:

http://drupal.org/project/galleryformatter – module

http://drupal.org/node/1086962 – documentation

http://drupal.org/node/1271064 – readme

Overview for my approach

  • Custom Content Type for images – one for members of my site one for admins
  • Gallery Formatter – for the format at the Content Type level
  • ME Alias module for replacement patterns, like Token, uses Token, I believe
  • Views/Panels (of course)
  • Multiupload – module
  • Colorbox – module
  • Field Formatter Class mod – Module – Helps define CSS classes at the content level

That’s it for now. I hope to put this to bed today if I can.

Define Custom Content Type CSS classes

This is a really cool module. And surprisingly, it doesn’t seem to have gotten a lot of attention. But the Field Formatter Class Module is really pretty simple and straightforward. And with Drupal, I really like the KISS rule…

This module allows you to define a CSFF class1S class on a per field basis. You do this in the Display Settings for the field of the content type taht you are working with. So,

  • I create a Content type called admin galleries for image galleries taht I, an admin, create.
  • On the image field, I assign the class admin-gallery. this option is available because of the module
  • now, i can add CSS as seen below to that specific class and only that content type will be affected. so I can style any
  • gallery this way as long as I use that content type for the gallery. which makes sense anyway. Image
  • I can also create a content type for user-galleries and style all those in a consistent way. and that is the real point that i wanted to acheive anyway.

 

 

 

Very cool module. And this post is where I heard about it. It has some other useful ideas on this subject too.

http://drupal.stackexchange.com/questions/30561/add-a-css-class-to-field-in-content-type

 

 

Manage System Messages

The standard Drupal system messages are really intrusive once you start to customize your site via Panels and CSS. For me, the green boxed messages push my pages down and break the presentation. Plus, they just don’t look very… NICE. So here is a great module. Nice Messages leverages the JGrowl JS library make the normal messages appear as in the SS below. There are even options on where the message should appear and how long. VERY NICE!

Image