Magento 2.3.0

I've added an split button to admin product edit page with this code ...

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
            <button name="translate" class="Vendor\Module\Block\Adminhtml\Catalog\Product\Edit\Button\Action"/>

... the block class with this method ...

public function getButtonData()
    return [
        'label' => __('Label'),
        'options' => $this->getOptions(),
        'class_name' => \Magento\Ui\Component\Control\Container::SPLIT_BUTTON,
        'class' => 'secondary',
        'button_class' => 'secondary'

This correctly adds a split button, but as first right button. If I've understood DevDocs right, button should be ordered by "priority" (primary, secondary, ...), but is doesn't work here.

Any ideas how to change this?


Magento button has a property called sort_order to set the priority of the buttons. In your case, you should add this property in getButtonData() function. Example: I will set sort_order=1000

public function getButtonData()
        return [
            'label' => __('Translate'),
            'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')),
            'class' => 'action-primary',
            'sort_order' => 1000

} The new button will be shown after Add Attribute button like this: enter image description here

Change sort_order to 10, the new button will be shown before Add Attribute button: enter image description here

If this solves your issue, please give me a vote


  • TXH, i kown about sort_order, but a) it doesnt work correctly with split buttons and b) as said - if i got DevDocs right, it should grouped by level "primary" / "seondary" ... – sv3n Dec 20 '18 at 22:59
  • primary and secondary are the class name of these buttons, it used to group buttons and style. If you want to set the priority, you should use sort_order – bachlee89 Dec 20 '18 at 23:02
  • Nope, sort_order has no effect for split button. Tried with 1 and 1000 and its always first. Please try with this line added 'class_name' => \Magento\Ui\Component\Control\Container::SPLIT_BUTTON,. – sv3n Dec 20 '18 at 23:10
  • WTH ... I say it does not work and someone votes up .... – sv3n Dec 20 '18 at 23:15
  • I think they see my effort and kindness so they gave me a vote. Someone can be faced an analog issue like you. – bachlee89 Dec 20 '18 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.