Add attributes to blocks

Permalink
I am working on a site where we would like to be able to add searchable metadata to blocks, has anyone looked into how to accomplish this or know how to do it?

The use case is: We have parts for vintage motorcycles and the parts often fit more than one specific manufacture, model &/or year so I would like to be able to add/edit metadata with the relevant info about what motorcycles the parts work with as add each block.

I am thinking it is analogous to page attributes but on a block by block level. So I was wondering about extending the default blocks to metadata (attributes) like pages do.

Thank you for any suggestions you have.

nikkor
 
adavis replied on at Permalink Reply 1 Attachment
adavis
Any progress with this? I have created a block that makes a mega menu from a scrapbook. In the scrapbook you can have any sort of block you like (ex. autonav, content, image, etc.). The mega menu is somewhat manually setup by nature, but I wanted a way to specify the width of the individual drop down menus (basically would map to a class like class="dropdown_3columns" etc.)
I Would like to be able to attach this to a block itself. The only thought I had was to change the /elements/custom_style.php to replace the 'additional css' field with a choice dropdown, which works, but it isnt oo elegant...
<h2><?php  echo t('Additional CSS')?></h2> 
        <textarea name="css_custom" cols="50" rows="4" style="width:99%"><?php echo htmlentities($style->getCustomStyleRuleCSSCustom(), ENT_COMPAT, APP_CHARSET) ?></textarea>


with

<h2>Mega Menu Column Width</h2>
      <?php $tmp_choice = $style->getCustomStyleRuleCSSCustom() ?>
      <select name="css_custom">
         <option value="dropdown_1column" <?php if($tmp_choice=='dropdown_1column'){echo 'selected="selected"';}?> >1 Column Wide</option>
         <option value="dropdown_2columns" <?php if($tmp_choice=='dropdown_2columns'){echo 'selected="selected"';}?>>2 Columns Wide</option>
         <option value="dropdown_3columns" <?php if($tmp_choice=='dropdown_3columns'){echo 'selected="selected"';}?>>3 Columns Wide</option>
         <option value="dropdown_4columns" <?php if($tmp_choice=='dropdown_4columns'){echo 'selected="selected"';}?>>4 Columns Wide</option>
         <option value="dropdown_5columns" <?php if($tmp_choice=='dropdown_5columns'){echo 'selected="selected"';}?>>5 Columns Wide</option>
      </select>
      <br/>If this block is contained within a scrapbook that is chosen to be a mega menu, this is the width the menu will render to.