在Sugarcrm的DetailView上隐藏/删除“创建”按钮

时间:2014-06-23 10:14:25

标签: php sugarcrm

在我的一个糖定制模块中,我不需要DetailView上的“编辑”和“创建”按钮。我已成功删除了“编辑”按钮,使用view.detail.php文件中的以下代码。

unset($this->dv->defs['templateMeta']['form']['buttons'][0]);
unset($this->dv->defs['templateMeta']['form']['buttons'][1]);
unset($this->dv->defs['templateMeta']['form']['buttons'][2]);
unset($this->dv->defs['templateMeta']['form']['buttons'][3]);

现在我想从DetailView中删除“创建”按钮。我已经搜索过但没有得到任何有用的东西。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:1)

只需找到您模块的detailviewdefs.php并将其复制到custom / modules / {yourmodulenamehere} / matadata / 并从按钮数组中删除您不想要的按钮: (以下是模块会议的详细视图,例如)

$viewdefs ['yourmodulenamehere'] = 
array (
  'DetailView' => 
  array (
    'templateMeta' => 
    array (
      'form' => 
      array (
        'buttons' => 
        array (
          0 => 'EDIT',
          1 => 'DUPLICATE',
          2 => 'DELETE',
          3 => 
          array (
            'customCode' => '{if $fields.status.value != "Held"} <input type="hidden" name="isSaveAndNew" value="false">  <input type="hidden" name="status" value="">  <input type="hidden" name="isSaveFromDetailView" value="true">  <input title="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_TITLE}"  accesskey="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_KEY}"  class="button"  onclick="this.form.status.value=\'Held\'; this.form.action.value=\'Save\';this.form.return_module.value=\'Meetings\';this.form.isDuplicate.value=true;this.form.isSaveAndNew.value=true;this.form.return_action.value=\'EditView\'; this.form.isDuplicate.value=true;this.form.return_id.value=\'{$fields.id.value}\';"  name="button"  value="{$APP.LBL_CLOSE_AND_CREATE_BUTTON_TITLE}"  type="submit">{/if}',
          ),
          4 => 
          array (
            'customCode' => '{if $fields.status.value != "Held"} <input type="hidden" name="isSave" value="false">  <input title="{$APP.LBL_CLOSE_BUTTON_TITLE}"  accesskey="{$APP.LBL_CLOSE_BUTTON_KEY}"  class="button"  onclick="this.form.status.value=\'Held\'; this.form.action.value=\'Save\';this.form.return_module.value=\'Meetings\';this.form.isSave.value=true;this.form.return_action.value=\'DetailView\'; this.form.return_id.value=\'{$fields.id.value}\'"  name="button1"  value="{$APP.LBL_CLOSE_BUTTON_TITLE}"  type="submit">{/if}',
          ),
        ),
      ),
      'maxColumns' => '2',
      'widths' => 
file goes on........