編集フォームのアクションを追加するには
管理クラスに追加します。
protected function configureSideMenu(MenuItemInterface $menu, $action, Admin $childAdmin = null)
{
if (!$childAdmin && !in_array($action, array('edit'))) {
return;
}
$admin = $this->isChild() ? $this->getParent() : $this;
$id = $admin->getRequest()->get('id');
$menu->addChild('My action', array('uri' => 'http://google.com?id=' . $id));
}
/admin/acme/videos/x/edit/ などのアクションの左側のメニューを作成します。現在のアイテムの ID を使用すると、任意のカスタム URL を構築できます。
リストにアクションを追加するには: 管理ファイルに追加します。
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->add('_action', 'actions', array(
'actions' => array(
'act' => array('template' => 'AcmeBundle:Video:my_temp.html.twig'),
)
))
;
}
リンク付きの列が追加されます。次に、列のテンプレートを作成する必要があります。
<a href="{{ admin.generateObjectUrl('delete', object) }}" class="delete_link" title="{% trans from 'SonataAdminBundle' %}action_delete{% endtrans %}">
<img src="{{ asset('bundles/sonataadmin/famfamfam/delete.png') }}" alt="{% trans from 'SonataAdminBundle' %}action_delete{% endtrans %}" />
</a>
すべての例は、あなたが提供したリンクから取られています。それが役に立てば幸い