Subpanel "Create" button hide based on condition

Hi All,

I need to hide the Subpanel “Create” button based on condition .

** Condition ; Accounts -> opportunities {subpanel}
If the user done have contacts – “Create” opportunity button should be disabled.

You can use this technique

In custom/modules/Accounts/views/view.list.php save this

class CustomAccountsViewList extends ViewList
     * @see ViewList::preDisplay()
    public function preDisplay()

        // here, change the contents of $this->lv->actionsMenuExtraItems 
        // according to your requirements and condition

I think this should work. If you can get it working please share your final solution here. Thanks