1
关于Magento2后端表单按钮“保存”,“保存并继续”
要通过ui_component创建后端表单,我在配置文件中定义以下内容以显示按钮save和saveAndContinue Button <item name="buttons" xsi:type="array"> <item name="save" xsi:type="string">namespace\module\Block\Adminhtml\Edit\SaveButton</item> <item name="save_and_continue" xsi:type="string">namespace\module\Block\Adminhtml\Edit\SaveAndContinueButton</item> </item> 分别创建了两个文件SaveButton.php和SaveAndContinueButton.php,并且都实现了ButtonProviderInterface 据我所知,按钮主要是从getButtonData函数渲染的。看到SaveAndContinueButton.php public function getButtonData() { $TodoItemId = $this->getTodoItemId(); $data = []; if ($TodoItemId) { $data = [ 'label' => __('Save and Continue Edit'), 'class' => 'save', 'data_attribute' => [ 'mage-init' => [ 'button' => ['event' => 'saveAndContinueEdit'], …