Mixin_Form_Instance_Methods

The NextGEN Gallery Mixin Form Instance Methods class.

Defined (1)

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

/products/photocrati_nextgen/modules/nextgen_admin/package.module.nextgen_admin.php  
  1. class Mixin_Form_Instance_Methods extends Mixin 
  2. /** 
  3. * Enqueues any static resources required by the form 
  4. */ 
  5. function enqueue_static_resources() 
  6. /** 
  7. * Gets a list of fields to render 
  8. * @return array 
  9. */ 
  10. function _get_field_names() 
  11. return array(); 
  12. function get_id() 
  13. return $this->object->context; 
  14. function get_title() 
  15. return $this->object->context; 
  16. /** 
  17. * Saves the form/model 
  18. * @param array $attributes 
  19. * @return type 
  20. */ 
  21. function save_action($attributes = array()) 
  22. if (!$attributes) { 
  23. $attributes = array(); 
  24. if ($this->object->has_method('get_model') && $this->object->get_model()) { 
  25. return $this->object->get_model()->save($attributes); 
  26. } else { 
  27. return TRUE; 
  28. /** 
  29. * Returns the rendered form 
  30. */ 
  31. function render($wrap = TRUE) 
  32. $fields = array(); 
  33. foreach ($this->object->_get_field_names() as $field) { 
  34. $method = "_render_{$field}_field"; 
  35. if ($this->object->has_method($method)) { 
  36. $fields[] = $this->object->{$method}($this->object->get_model()); 
  37. return $this->object->render_partial('photocrati-nextgen_admin#form', array('fields' => $fields, 'wrap' => $wrap), TRUE); 
  38. function get_model() 
  39. return $this->object->page->has_method('get_model') ? $this->object->page->get_model() : NULL;