Mixin_Displayed_Gallery_Defaults

Adds default values for the displayed gallery.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/nextgen_gallery_display/package.module.nextgen_gallery_display.php  
  1. class Mixin_Displayed_Gallery_Defaults extends Mixin 
  2. /** 
  3. * Gets a display type object for a particular entity 
  4. * @param stdClass|C_DataMapper_Model $entity 
  5. * @return null|stdClass 
  6. */ 
  7. function get_display_type($entity) 
  8. $mapper = C_Display_Type_Mapper::get_instance(); 
  9. return $mapper->find_by_name($entity->display_type); 
  10. /** 
  11. * Sets defaults needed for the entity 
  12. * @param type $entity 
  13. */ 
  14. function set_defaults($entity) 
  15. // Ensure that we have a settings array 
  16. if (!isset($entity->display_settings)) { 
  17. $entity->display_settings = array(); 
  18. // If the display type is set, then get it's settings and apply them as 
  19. // defaults to the "display_settings" of the displayed gallery 
  20. if (isset($entity->display_type)) { 
  21. // Get display type mapper 
  22. if ($display_type = $this->object->get_display_type($entity)) { 
  23. $entity->display_settings = $this->array_merge_assoc($display_type->settings, $entity->display_settings, TRUE); 
  24. // Default ordering 
  25. $settings = C_NextGen_Settings::get_instance(); 
  26. $this->object->_set_default_value($entity, 'order_by', $settings->galSort); 
  27. $this->object->_set_default_value($entity, 'order_direction', $settings->galSortDir); 
  28. // Ensure we have an exclusions array 
  29. $this->object->_set_default_value($entity, 'exclusions', array()); 
  30. // Ensure other properties exist 
  31. $this->object->_set_default_value($entity, 'container_ids', array()); 
  32. $this->object->_set_default_value($entity, 'excluded_container_ids', array()); 
  33. $this->object->_set_default_value($entity, 'sortorder', array()); 
  34. $this->object->_set_default_value($entity, 'entity_ids', array()); 
  35. $this->object->_set_default_value($entity, 'returns', 'included'); 
  36. // Set maximum_entity_count 
  37. $this->object->_set_default_value($entity, 'maximum_entity_count', $settings->maximum_entity_count);