|
@@ -2963,4 +2963,70 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * {@inheritdoc}
|
|
|
|
+ */
|
|
|
|
+ public function configureActionButtons($action, $object = null)
|
|
|
|
+ {
|
|
|
|
+ $list = array();
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('show', 'edit', 'delete', 'list', 'batch'))) {
|
|
|
|
+ $list['create'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:create_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('show', 'delete', 'acl', 'history')) && $object) {
|
|
|
|
+ $list['edit'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:edit_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('show', 'edit', 'acl')) && $object) {
|
|
|
|
+ $list['history'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:history_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('edit', 'history')) && $object) {
|
|
|
|
+ $list['acl'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:acl_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('edit', 'history', 'acl')) && $object) {
|
|
|
|
+ $list['show'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:show_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (in_array($action, array('show', 'edit', 'delete', 'acl', 'batch'))) {
|
|
|
|
+ $list['list'] = array(
|
|
|
|
+ 'template' => 'SonataAdminBundle:Button:list_button.html.twig',
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $list;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param string $action
|
|
|
|
+ * @param mixed $object
|
|
|
|
+ *
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ public function getActionButtons($action, $object = null)
|
|
|
|
+ {
|
|
|
|
+ $list = $this->configureActionButtons($action, $object);
|
|
|
|
+
|
|
|
|
+ foreach ($this->getExtensions() as $extension) {
|
|
|
|
+ // TODO: remove method check in next major release
|
|
|
|
+ if (method_exists($extension, 'configureActionButtons')) {
|
|
|
|
+ $list = $extension->configureActionButtons($this, $list, $action, $object);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $list;
|
|
|
|
+ }
|
|
}
|
|
}
|