9
में कार्रवाई जोड़ना मैं सोनाटा व्यवस्थापक बंडल में एक क्रिया जोड़ने की कोशिश कर रहा हूं। मैं के साथ मेरी व्यवस्थापक वर्ग बदल दिया है:सोनाटाएडमिनबंडल
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id')
->add('name')
// add custom action links
->add('_action', 'actions', array(
'actions' => array(
'view' => array(),
'calculate' => array('template' => 'myappMyBundle:Admin:list__action_calculate.html.twig'),
'edit' => array(),
)
))
;
}
और
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('calculate', array('uri' => 'http://google.com?id=' . $id));
}
और/src/MyApp/MyBundle/संसाधन/विचारों/व्यवस्थापक में list__action_calculate.html.twig नामक एक टेम्पलेट डाल:
{% if admin.isGranted('EDIT', object) and admin.hasRoute('edit') %}
<a href="{{ admin.generateObjectUrl('calculate', object) }}" class="calculate_link" title="{{ 'action_calculate'|trans({}, 'SonataAdminBundle') }}">
<img src="{{ asset('bundles/sonataadmin/famfamfam/page_white_edit.png') }}" alt="{{ 'action_calculate'|trans({}, 'SonataAdminBundle') }}" />
</a>
{% endif %}
लेकिन मैं सिम्फोनी से यह त्रुटि आई:
An exception has been thrown during the rendering of a template
("unable to find the route `mysite.mybundle.admin.myentity.calculate`")
in "SonataAdminBundle:CRUD:list.html.twig"
मुझे क्या याद आया? Doc के इस पृष्ठ की तुलना में दस्तावेज़ में कोई संकेत है।
सरकारी प्रलेखन: [बैच क्रियाएं] (http://sonata-project.org/bundles/admin/2-2/doc/reference/batch_actions.html) –
नया दस्तावेज़ जाना है ओडी, अद्यतन के लिए धन्यवाद। – user1254498