iconify alfa 0.2 code

9 April 2007 mortendk
add icons to the admin areas of drupal with clean css styles

a new approach to add icons into the admin areas of mighty drupal

#000000">#0000BB"><?php
#007700">function #0000BB">iconofy_get_orig_title#007700">(#0000BB">$title#007700">){
   
#FF8000">//get the original title if we use localization
   
#007700">if(#0000BB">module_exists#007700">(#0000BB">Locale#007700">)){
     
#0000BB">$sql #007700">=#DD0000">"SELECT s.source FROM locales_target t JOIN locales_source s ON t.lid = s.lid WHERE translation ='%s' "#007700">;
     
#0000BB">$result #007700">= #0000BB">db_query#007700">(#0000BB">$sql#007700">,#0000BB">$title#007700">);
     
#0000BB">$title #007700">= #0000BB">db_result#007700">(#0000BB">$result#007700">, #0000BB">$row #007700">= #0000BB">0#007700">);
    }else{
       
#0000BB">$title #007700">= #0000BB">$title#007700">;
    }
   
#FF8000">//rename the title
   
#0000BB">$title#007700">=#0000BB">strtolower#007700">(#0000BB">str_replace#007700">(#DD0000">' '#007700">,#DD0000">'_'#007700">,#0000BB">$title#007700">));
   
#0000BB">$icon#007700">=#0000BB">strtolower#007700">(#0000BB">str_replace#007700">(#DD0000">'\''#007700">,#DD0000">''#007700">,#0000BB">$title#007700">));
   
    return
#0000BB">$icon#007700">;
}

#FF8000">/**
* theming
*/
#007700">function #0000BB">phptemplate_fieldset#007700">(#0000BB">$element#007700">) {
#FF8000">//  drupal_add_css(drupal_get_path('module', 'iconify') .'/iconify.css');

 
#007700">if (#0000BB">$element#007700">[#DD0000">'#collapsible'#007700">]) {
   
#0000BB">drupal_add_js#007700">(#DD0000">'misc/collapse.js'#007700">);

   
#0000BB">$element#007700">[#DD0000">'#attributes'#007700">][#DD0000">'class'#007700">] .= #DD0000">' collapsible'#007700">;
    if (
#0000BB">$element#007700">[#DD0000">'#collapsed'#007700">]) {
       
#0000BB">$element#007700">[#DD0000">'#attributes'#007700">][#DD0000">'class'#007700">] .= #DD0000">' collapsed'#007700">;
    }
  }

   
#0000BB">$icon #007700">= #0000BB">iconofy_get_orig_title#007700">(#0000BB">$element#007700">[#DD0000">'#title'#007700">]);
return
#DD0000">'<fieldset ' #007700">. #0000BB">drupal_attributes#007700">(#0000BB">$element#007700">[#DD0000">'#attributes'#007700">]) .#DD0000">'>' #007700">.
  (
#0000BB">$element#007700">[#DD0000">'#title'#007700">] ? #DD0000">'<legend><span id="icon_'#007700">.#0000BB">$icon#007700">.#DD0000">'" class="icon"></span>'#007700">. #0000BB">$element#007700">[#DD0000">'#title'#007700">] .#DD0000">'</legend>' #007700">: #DD0000">''#007700">) .
  (
#0000BB">$element#007700">[#DD0000">'#description'#007700">] ? #DD0000">'<div class="description">'#007700">. #0000BB">$element#007700">[#DD0000">'#description'#007700">] .#DD0000">'</div>' #007700">: #DD0000">''#007700">) . #0000BB">$element#007700">[#DD0000">'#children'#007700">] . #0000BB">$element#007700">[#DD0000">'#value'#007700">] .
#DD0000">"</fieldset>\n"#007700">;
}

function
#0000BB">phptemplate_admin_block_content#007700">(#0000BB">$content#007700">) {
  if (!
#0000BB">$content#007700">) {
    return
#DD0000">''#007700">;
  }

  if (
#0000BB">system_admin_compact_mode#007700">()) {
   
#0000BB">$output #007700">= #DD0000">'<ul class="menu">'#007700">;
    foreach (
#0000BB">$content #007700">as #0000BB">$item#007700">) {
     
#0000BB">$icon #007700">= #0000BB">iconofy_get_orig_title#007700">(#0000BB">$item#007700">[#DD0000">'title'#007700">]);
     
#0000BB">$output #007700">.= #DD0000">'<li class="leaf"><span id="icon_'#007700">.#0000BB">$icon#007700">.#DD0000">'" class="admin_icon"></span>'#007700">. #0000BB">l#007700">(#0000BB">$item#007700">[#DD0000">'title'#007700">], #0000BB">$item#007700">[#DD0000">'path'#007700">], array(#DD0000">'title' #007700">=> #0000BB">$item#007700">[#DD0000">'description'#007700">])) .#DD0000">'</li>'#007700">;
    }
   
#0000BB">$output #007700">.= #DD0000">'</ul>'#007700">;
  }
  else {
   
#0000BB">$output #007700">= #DD0000">'<dl class="admin-list">'#007700">;

    foreach (
#0000BB">$content #007700">as #0000BB">$item#007700">) {
     
#0000BB">$icon #007700">= #0000BB">iconofy_get_orig_title#007700">(#0000BB">$item#007700">[#DD0000">'title'#007700">]);

     
#0000BB">$output #007700">.= #DD0000">'<span id="icon_'#007700">.#0000BB">$icon#007700">.#DD0000">'" class="admin_icon"></span>'#007700">;
     
#0000BB">$output #007700">.= #DD0000">'<dt>'#007700">. #0000BB">l#007700">(#0000BB">$item#007700">[#DD0000">'title'#007700">], #0000BB">$item#007700">[#DD0000">'path'#007700">]) .#DD0000">'</dt>'#007700">;
     
#0000BB">$output #007700">.= #DD0000">'<dd>'#007700">. #0000BB">$item#007700">[#DD0000">'description'#007700">] .#DD0000">'</dd>'#007700">;
    }
   
#0000BB">$output #007700">.= #DD0000">'</dl>'#007700">;
  }
  return
#0000BB">$output#007700">;
}

function
#0000BB">phptemplate_admin_block#007700">(#0000BB">$block#007700">) {
 
#FF8000">// Don't display the block if it has no content to display.
 
#007700">if (!#0000BB">$block#007700">[#DD0000">'content'#007700">]) {
    return
#DD0000">''#007700">;
  }
 
#0000BB">$icon #007700">= #0000BB">iconofy_get_orig_title#007700">(#0000BB">$block#007700">[#DD0000">'title'#007700">]);
 
#0000BB">$output #007700">= <<< EOT
#0000BB">  <div id="admin-$icon" class="admin-panel">
    <h3>
      $block
#007700">[#0000BB">title#007700">]#0000BB">
    </h3>
    <div class="body">
      <p class="description">
        $block
#007700">[#0000BB">description#007700">]#0000BB">
      </p>
      $block
#007700">[#0000BB">content#007700">]#0000BB">
    </div>
  </div>
#007700">EOT;
  return
#0000BB">$output#007700">;
}
#0000BB">?>

AttachmentSize
iconify.zip55.84 KB
The content of this field is kept private and will not be shown publicly.
forskelligheder: http://wp.me/pPqEp-6P 51 min 9 sec ago
1,241

freya rocks

the progress for my premature daughter can be folllowed here:
Freya Rocks
sorry its in danish

the blög

Upcoming events

places im gonna attend + speak at:

  • Drupaljam - amsterdam
    19 Mar 2010 (All day)
  • DC San Francisco
    19 Apr 2010 (All day) - 21 Apr 2010 (All day)
  • drupalcamp copenhagen 2010
    21 May 2010 (All day) - 23 May 2010 (All day)

good Stüff

Mothership - a clean up the crap "theme"

Miro - a open atrium theme:
more info & comments

User login

Recent comments

give some luv

drupal member ...

geek royale