mirror of
https://github.com/e107inc/e107.git
synced 2025-07-28 18:30:53 +02:00
Added option to override/modify default Create/Update buttons (triggers)
eg. $this->setDefaultTrigger(array('cancel' => array(LAN_CANCEL, 'cancel'))); // display only a cancel button.
This commit is contained in:
@@ -1647,6 +1647,12 @@ class e_admin_controller
|
|||||||
* @var string default action name
|
* @var string default action name
|
||||||
*/
|
*/
|
||||||
protected $_default_action = 'index';
|
protected $_default_action = 'index';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string default trigger action.
|
||||||
|
*/
|
||||||
|
protected $_default_trigger = 'auto';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List (numerical array) of only allowed for this controller actions
|
* List (numerical array) of only allowed for this controller actions
|
||||||
@@ -2358,6 +2364,14 @@ class e_admin_controller
|
|||||||
return $this->_default_action;
|
return $this->_default_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getDefaultTrigger()
|
||||||
|
{
|
||||||
|
return $this->_default_trigger;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set default action
|
* Set default action
|
||||||
* @param string $action_name
|
* @param string $action_name
|
||||||
@@ -2369,6 +2383,21 @@ class e_admin_controller
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set default trigger
|
||||||
|
* @param string|array $triggers 'auto' or array of triggers
|
||||||
|
* @example $triggers['submit'] = array(LAN_UPDATE, 'update', $model->getId());
|
||||||
|
$triggers['submit'] = array(LAN_CREATE, 'create', 0);
|
||||||
|
$triggers['cancel'] = array(LAN_CANCEL, 'cancel');
|
||||||
|
* @return e_admin_controller
|
||||||
|
*/
|
||||||
|
public function setDefaultTrigger($triggers)
|
||||||
|
{
|
||||||
|
$this->_default_trigger = $triggers;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@@ -6563,10 +6592,11 @@ class e_admin_form_ui extends e_form
|
|||||||
'footer' => $form_end, //XXX Unused?
|
'footer' => $form_end, //XXX Unused?
|
||||||
'after_submit_options' => $controller->getAfterSubmitOptions(), // or true for default redirect options
|
'after_submit_options' => $controller->getAfterSubmitOptions(), // or true for default redirect options
|
||||||
'after_submit_default' => $request->getPosted('__after_submit_action', $controller->getDefaultAction()), // or true for default redirect options
|
'after_submit_default' => $request->getPosted('__after_submit_action', $controller->getDefaultAction()), // or true for default redirect options
|
||||||
'triggers' => 'auto', // standard create/update-cancel triggers
|
'triggers' => $controller->getDefaultTrigger(), // standard create/update-cancel triggers
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$models[] = $controller->getModel();
|
$models[] = $controller->getModel();
|
||||||
|
|
||||||
return $this->renderCreateForm($forms, $models, e_AJAX_REQUEST);
|
return $this->renderCreateForm($forms, $models, e_AJAX_REQUEST);
|
||||||
|
Reference in New Issue
Block a user