abstract run() This function should implement the logic of the view. protected redirect($url, $status_code=302) This function performs a redirect to the provided url.
TemplateView extends View.
run()run_exception($exception):run_form($form)run_page()$this->template is set, return that.$view_name is set, return '[base_name]_[view_name].phtml'.'[base_name].phtml'.
Where $base_name defaults to 'template_[page_id]' but can be overriden by setting the $template_base_name property.
protected $page_id String used to identify the template name and the page titleprotected $template Contains the view's form, but obsolete if you override get_form().protected $template_base_name Contains the view's success_url, but obsolete if you override get_succes_url() or run_form_valid().protected $title Contains a human readable page title.
TemplateView inherits all functions from View. It implements run().
__construct($page_id, $title='')run() This function runs the logic of the view. It should not be overridden, as it makes sure exceptions are correctly rendered. If you want to customize how views are executed, you should override run_page().protected run_page()protected run_exception($e)protected render_template($template, array $context=[]) Renders a template with context. Merges in the default context.protected function get_default_context() Returns the default context. The default implementation returns the view's $title and $page_id.protected function get_template($view_name='')
FormView extends TemplateView.
run()run_page()run_form($form)run_form_valid($form)process_form_data($data)run_form_invalid($form)
FormView inherits all properties from TemplateView.
protected $form Contains the view's form, but obsolete if you override get_form().protected $success_url Contains the view's success_url, but obsolete if you override get_succes_url() or run_form_valid().
FormView inherits all functions from TemplateView. It implements run_page().
protected run_form($form) It is not recommended to override this function if you want to customize form handling. Override form_valid() and form_invalid() instead.protected form_valid($form)protected form_invalid($form)abstract protected process_form_data($data) This function should implement the logic used to process the form data. The $data variable is an associated array containing field_name ⇒ value pairs.protected get_form()protected get_success_url()
ModelView extends FormView.
run()run_page()run_create()get_form()run_form($form) according to FormView pipelinerun_read()get_object()run_update()get_form()get_object()run_form($form) according to FormView pipelinerun_delete()run_list()
ModelView inherits all properties from FormView.
protected $views List of implemented views. Defaults to ['create', 'read', 'update', 'delete', 'list']. Additionally a view for export to CSV ('csv') has been implemented, but is disabled by default.protected $default_view The name of the view to run if the URL parameter view is not provided. Defaults to "list".protected $model Contains the view's model object, but obsolete if you override get_model().
ModelView inherits all functions from FormView. It implements process_form_data() and overrides __construct(), run_page(), get_success_url() and get_template().
public __construct($page_id, $title='', $model=null, $form=null)protected run_page() It is not recommended to override this function unless you want to create additional views. Override run_create(), run_read(), run_update(), run_delete(), run_list() and run_csv() instead.protected run_create()protected run_read()protected run_update()protected run_delete()protected run_list()protected run_csv() Disabled by default. Enable by overriding $views (add 'csv').protected get_csv_data() Provides dataset for run_csv() as associative array.protected process_form_data($data) Creates or updates object in database.protected get_model()protected get_object()protected get_success_url() Overridden to redirect to the default view.protected get_template($view_name='') Overridden to render the template for the active view if $view_name is not provided.