Overwrite the "get_others" method on your model like so:
function get_others($display_field, $id, $val_field = NULL)
{
return array();
}
To add action to the toolbar, I'm assuming you are referring to the area where you edit a module's records and usually has a "Save", "View", "Publish", "Delete"...? If so, there is a "item_actions" property you can set on your modules config which by default is: array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create') You can add an "other" value to that array which can contain a nested array with keys being URI paths and values being labels. array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create', 'others' => array('my_action' => 'My Action'))
Unfortunately, that is not supported at the moment. Although, it could be easily changed in the fuel/modules/fuel/views/_blocks/module_create_edit_actions.php file so that it is not inside the if condition that checks that the action is "edit".
Well - there is only save and i needed a cancel - if user visits create by accident, need a way to cancel. So I just added a cancel. Could not think of any other way.
Comments
function get_others($display_field, $id, $val_field = NULL) { return array(); }
To add action to the toolbar, I'm assuming you are referring to the area where you edit a module's records and usually has a "Save", "View", "Publish", "Delete"...? If so, there is a "item_actions" property you can set on your modules config which by default is:
array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create')
You can add an "other" value to that array which can contain a nested array with keys being URI paths and values being labels.
array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create', 'others' => array('my_action' => 'My Action'))
How can i add a custom button or link on create_edit page?
a item is added in edit mode. - need to have a tool in create mode too.
<?php if ($this->fuel_auth->module_has_action('others')) : ?>
<?php foreach($this->item_actions['others'] as $other_action => $label) :
$ico_key = str_replace('/', '_', $other_action);
$lang_key = url_title($label, 'underscore', TRUE);
if ($new_label = lang('btn_'.$lang_key)) $label = $new_label;
?>
<?=anchor(fuel_url($other_action), $label, array('class' => 'submit_action ico ico_'.$ico_key))?>
<?php endforeach; ?>
<?php endif; ?>
Thank you so very much.