Galleries: How to refer to a storage_location's Location Type's icon & color?

Pawtucket2. Browsing a Gallery of Storage Locations, I would like /views/Gallery/detail_html.php to be able to display the icon & color of the Storage_Location's storage_location_types.

I got as far as (working only in set_item_info_html.php):

$obs = $this->getVar("object");

$idno = $obs->get('ca_storage_locations.idno');

to get the storage locations's idno. so I can build a database query...

But "object" doesn't seem to be set for detail.html.php, only set_item_info_html.php.


Within /details/ca_storage_locations_default_html.php I have used (but have not figured out how to adapt this to detail.html.php)

//Icon and Color:

$t_object = $this->getVar("item");

$t_type =  $t_object->getTypeInstance();

$vs_color = null;

if ($t_type) { $vs_color = trim($t_type->get('color')); } 

if (!$vs_color && $t_type) { $vs_color = trim($t_type->get('color')); }

if (!$vs_color) { $vs_color = "FFFFFF"; }

$vs_icon = null;

if ($t_type) { $vs_icon = $t_type->getMediaTag('icon', 'icon'); }

$vs_icon = $t_type->getMediaTag('icon', 'icon');

if ($vs_icon){

$icon = "<div style='width:75px; border:6px solid #{$vs_color};'>{$vs_icon}</div>\n";

}


I could start querying the database but I feel like that might be re-inventing the wheel.

Thanks

Comments

  • I think what I am really after is the ability to set a placeholder_media_icon that is set to the icon of the type_id of an item, not just in galleries, but also in browses.

    i.e. When browsing storage_locations, or galleries of storage_locations, if the storage_location does not have a media representation, then the placeholder icon becomes the Box icon, or Folder icon, or Shelf icon, etc etc as defined in the list_items entry for the type.


    If I approach this as a placeholder then I do not have to mess around with /views/Gallery at all

Sign In or Register to comment.