How can i remove "select another" dropdown" in simple module

edited September 2012 in Modules
Also nee to be able to add custom links or button in toolbar. How do i do it.

thanks

Comments

  • edited 9:19PM
    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'))
  • edited 9:19PM
    I know how to add in item_actions in list view.
    How can i add a custom button or link on create_edit page?
  • edited 9:19PM
    Does changing the item_actions (not "list_actions" or "table_actions") and adding the "others" key not work for you?
  • edited 9:19PM
    array('save', 'view', 'publish', 'activate', 'delete', 'duplicate', 'create')
    a item is added in edit mode. - need to have a tool in create mode too.
  • edited 9:19PM
    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".
  • edited 9:19PM
    Put the following within "create" section and it worked.

    <?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.
  • edited 9:19PM
    Out of curiosity, what was the scenario in which you needed to have an action on creating a record?
  • edited September 2012
    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.
Sign In or Register to comment.