AdminInterface.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Admin;
  11. use Sonata\AdminBundle\Admin\Pool;
  12. use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
  13. use Sonata\AdminBundle\Builder\FormContractorInterface;
  14. use Sonata\AdminBundle\Builder\ListBuilderInterface;
  15. use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
  16. use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
  17. use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
  18. use Sonata\AdminBundle\Builder\RouteBuilderInterface;
  19. use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
  20. use Sonata\AdminBundle\Validator\ErrorElement;
  21. use Sonata\AdminBundle\Route\RouteGeneratorInterface;
  22. use Knp\Menu\FactoryInterface as MenuFactoryInterface;
  23. use Knp\Menu\ItemInterface as MenuItemInterface;
  24. use Sonata\CoreBundle\Model\Metadata;
  25. use Symfony\Component\Validator\ValidatorInterface;
  26. use Symfony\Component\Translation\TranslatorInterface;
  27. use Symfony\Component\HttpFoundation\Request;
  28. interface AdminInterface
  29. {
  30. /**
  31. * @param \Sonata\AdminBundle\Builder\FormContractorInterface $formContractor
  32. *
  33. * @return void
  34. */
  35. public function setFormContractor(FormContractorInterface $formContractor);
  36. /**
  37. * Set ListBuilder
  38. *
  39. * @param ListBuilderInterface $listBuilder
  40. *
  41. * @return void
  42. */
  43. public function setListBuilder(ListBuilderInterface $listBuilder);
  44. /**
  45. * Get ListBuilder
  46. *
  47. * @return \Sonata\AdminBundle\Builder\ListBuilderInterface
  48. */
  49. public function getListBuilder();
  50. /**
  51. * Set DatagridBuilder
  52. *
  53. * @param \Sonata\AdminBundle\Builder\DatagridBuilderInterface $datagridBuilder
  54. *
  55. * @return void
  56. */
  57. public function setDatagridBuilder(DatagridBuilderInterface $datagridBuilder);
  58. /**
  59. * Get DatagridBuilder
  60. *
  61. * @return \Sonata\AdminBundle\Builder\DatagridBuilderInterface
  62. */
  63. public function getDatagridBuilder();
  64. /**
  65. * Set translator
  66. *
  67. * @param \Symfony\Component\Translation\TranslatorInterface $translator
  68. *
  69. * @return void
  70. */
  71. public function setTranslator(TranslatorInterface $translator);
  72. /**
  73. * Get translator
  74. *
  75. * @return \Symfony\Component\Translation\TranslatorInterface
  76. */
  77. public function getTranslator();
  78. /**
  79. * @param \Symfony\Component\HttpFoundation\Request $request
  80. *
  81. * @return void
  82. */
  83. public function setRequest(Request $request);
  84. /**
  85. * @param Pool $pool
  86. *
  87. * @return void
  88. */
  89. public function setConfigurationPool(Pool $pool);
  90. /**
  91. * @param \Sonata\AdminBundle\Route\RouteGeneratorInterface $routeGenerator
  92. *
  93. * @return void
  94. */
  95. public function setRouteGenerator(RouteGeneratorInterface $routeGenerator);
  96. /**
  97. * Returns subjectClass/class/subclass name managed
  98. * - subclass name if subclass parameter is defined
  99. * - subject class name if subject is defined
  100. * - class name if not
  101. *
  102. * @return string
  103. */
  104. public function getClass();
  105. /**
  106. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  107. *
  108. * @return void
  109. */
  110. public function attachAdminClass(FieldDescriptionInterface $fieldDescription);
  111. /**
  112. * @return \Sonata\AdminBundle\Datagrid\DatagridInterface
  113. */
  114. public function getDatagrid();
  115. /**
  116. * Set base controller name
  117. *
  118. * @param string $baseControllerName
  119. */
  120. public function setBaseControllerName($baseControllerName);
  121. /**
  122. * Get base controller name
  123. *
  124. * @return string
  125. */
  126. public function getBaseControllerName();
  127. /**
  128. * Generates the object url with the given $name
  129. *
  130. * @param string $name
  131. * @param mixed $object
  132. * @param array $parameters
  133. * @param boolean $absolute
  134. *
  135. * @return string return a complete url
  136. */
  137. public function generateObjectUrl($name, $object, array $parameters = array(), $absolute = false);
  138. /**
  139. * Generates an url for the given parameters
  140. *
  141. * @param string $name
  142. * @param array $parameters
  143. * @param bool $absolute
  144. *
  145. * @return string return a complete url
  146. */
  147. public function generateUrl($name, array $parameters = array(), $absolute = false);
  148. /**
  149. * Generates an url for the given parameters
  150. *
  151. * @param string $name
  152. * @param array $parameters
  153. * @param bool $absolute
  154. *
  155. * @return string return a complete url
  156. */
  157. public function generateMenuUrl($name, array $parameters = array(), $absolute = false);
  158. /**
  159. * @return \Sonata\AdminBundle\Model\ModelManagerInterface;
  160. */
  161. public function getModelManager();
  162. /**
  163. * @return string the manager type of the admin
  164. */
  165. public function getManagerType();
  166. /**
  167. * @param string $context
  168. *
  169. * @return \Sonata\AdminBundle\Datagrid\ProxyQueryInterface
  170. */
  171. public function createQuery($context = 'list');
  172. /**
  173. * @return \Symfony\Component\Form\FormBuilder the form builder
  174. */
  175. public function getFormBuilder();
  176. /**
  177. * Return FormFieldDescription
  178. *
  179. * @param string $name
  180. *
  181. * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface
  182. */
  183. public function getFormFieldDescription($name);
  184. /**
  185. * Build and return the collection of form FieldDescription
  186. *
  187. * @return array collection of form FieldDescription
  188. */
  189. public function getFormFieldDescriptions();
  190. /**
  191. * Returns a form depend on the given $object
  192. *
  193. * @return \Symfony\Component\Form\Form
  194. */
  195. public function getForm();
  196. /**
  197. * @return \Symfony\Component\HttpFoundation\Request
  198. *
  199. * @throws \RuntimeException if no request is set.
  200. */
  201. public function getRequest();
  202. /**
  203. * @return boolean true if a request object is linked to this Admin, false
  204. * otherwise.
  205. */
  206. public function hasRequest();
  207. /**
  208. *
  209. * @return string
  210. */
  211. public function getCode();
  212. /**
  213. *
  214. * @return string
  215. */
  216. public function getBaseCodeRoute();
  217. /**
  218. * Return the roles and permissions per role
  219. * - different permissions per role for the acl handler
  220. * - one permission that has the same name as the role for the role handler
  221. * This should be used by experimented users
  222. *
  223. * @return array [role] => array([permission], [permission])
  224. */
  225. public function getSecurityInformation();
  226. /**
  227. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $parentFieldDescription
  228. *
  229. * @return void
  230. */
  231. public function setParentFieldDescription(FieldDescriptionInterface $parentFieldDescription);
  232. /**
  233. * Get parent field description
  234. *
  235. * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface The parent field description
  236. */
  237. public function getParentFieldDescription();
  238. /**
  239. * Returns true if the Admin is linked to a parent FieldDescription
  240. *
  241. * @return bool
  242. */
  243. public function hasParentFieldDescription();
  244. /**
  245. * translate a message id
  246. *
  247. * @param string $id
  248. * @param array $parameters
  249. * @param null $domain
  250. * @param null $locale
  251. *
  252. * @return string the translated string
  253. */
  254. public function trans($id, array $parameters = array(), $domain = null, $locale = null);
  255. /**
  256. * Returns the list of available urls
  257. *
  258. * @return \Sonata\AdminBundle\Route\RouteCollection the list of available urls
  259. */
  260. public function getRoutes();
  261. /**
  262. * Return the parameter name used to represent the id in the url
  263. *
  264. * @return string
  265. */
  266. public function getRouterIdParameter();
  267. /**
  268. * Returns the parameter representing request id, ie: id or childId
  269. *
  270. * @return string
  271. */
  272. public function getIdParameter();
  273. /**
  274. * Returns true if the admin has a FieldDescription with the given $name
  275. *
  276. * @param string $name
  277. *
  278. * @return bool
  279. */
  280. public function hasShowFieldDescription($name);
  281. /**
  282. * add a FieldDescription
  283. *
  284. * @param string $name
  285. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  286. *
  287. * @return void
  288. */
  289. public function addShowFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  290. /**
  291. * Remove a ShowFieldDescription
  292. *
  293. * @param string $name
  294. */
  295. public function removeShowFieldDescription($name);
  296. /**
  297. * add a list FieldDescription
  298. *
  299. * @param string $name
  300. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  301. *
  302. * @return void
  303. */
  304. public function addListFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  305. /**
  306. * Remove a list FieldDescription
  307. *
  308. * @param string $name
  309. *
  310. * @return void
  311. */
  312. public function removeListFieldDescription($name);
  313. /**
  314. * Returns true if the filter FieldDescription exists
  315. *
  316. * @param string $name
  317. *
  318. * @return bool
  319. */
  320. public function hasFilterFieldDescription($name);
  321. /**
  322. * add a filter FieldDescription
  323. *
  324. * @param string $name
  325. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  326. *
  327. * @return void
  328. */
  329. public function addFilterFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  330. /**
  331. * Remove a filter FieldDescription
  332. *
  333. * @param string $name
  334. */
  335. public function removeFilterFieldDescription($name);
  336. /**
  337. * Returns the filter FieldDescription collection
  338. *
  339. * @return FieldDescriptionInterface[]
  340. */
  341. public function getFilterFieldDescriptions();
  342. /**
  343. * Returns a list depend on the given $object
  344. *
  345. * @return \Sonata\AdminBundle\Admin\FieldDescriptionCollection
  346. */
  347. public function getList();
  348. /**
  349. * @param \Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface $securityHandler
  350. *
  351. * @return void
  352. */
  353. public function setSecurityHandler(SecurityHandlerInterface $securityHandler);
  354. /**
  355. * @return \Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface|null
  356. */
  357. public function getSecurityHandler();
  358. /**
  359. * @param string $name
  360. * @param object|null $object
  361. *
  362. * @return boolean
  363. */
  364. public function isGranted($name, $object = null);
  365. /**
  366. * @param mixed $entity
  367. */
  368. public function getUrlsafeIdentifier($entity);
  369. /**
  370. * @param mixed $entity
  371. */
  372. public function getNormalizedIdentifier($entity);
  373. /**
  374. * Shorthand method for templating
  375. *
  376. * @param object $entity
  377. *
  378. * @return mixed
  379. */
  380. public function id($entity);
  381. /**
  382. * @param \Symfony\Component\Validator\ValidatorInterface $validator
  383. *
  384. * @return void
  385. */
  386. public function setValidator(ValidatorInterface $validator);
  387. /**
  388. * @return \Symfony\Component\Validator\ValidatorInterface
  389. */
  390. public function getValidator();
  391. /**
  392. * @return array
  393. */
  394. public function getShow();
  395. /**
  396. * @param array $formTheme
  397. *
  398. * @return void
  399. */
  400. public function setFormTheme(array $formTheme);
  401. /**
  402. * @return array
  403. */
  404. public function getFormTheme();
  405. /**
  406. * @param array $filterTheme
  407. *
  408. * @return void
  409. */
  410. public function setFilterTheme(array $filterTheme);
  411. /**
  412. * @return array
  413. */
  414. public function getFilterTheme();
  415. /**
  416. * @param AdminExtensionInterface $extension
  417. *
  418. * @return void
  419. */
  420. public function addExtension(AdminExtensionInterface $extension);
  421. /**
  422. * Returns an array of extension related to the current Admin
  423. *
  424. * @return AdminExtensionInterface[]
  425. */
  426. public function getExtensions();
  427. /**
  428. * @param \Knp\Menu\FactoryInterface $menuFactory
  429. *
  430. * @return void
  431. */
  432. public function setMenuFactory(MenuFactoryInterface $menuFactory);
  433. /**
  434. * @return \Knp\Menu\FactoryInterface
  435. */
  436. public function getMenuFactory();
  437. /**
  438. * @param \Sonata\AdminBundle\Builder\RouteBuilderInterface $routeBuilder
  439. */
  440. public function setRouteBuilder(RouteBuilderInterface $routeBuilder);
  441. /**
  442. * @return \Sonata\AdminBundle\Builder\RouteBuilderInterface
  443. */
  444. public function getRouteBuilder();
  445. /**
  446. * @param mixed $object
  447. *
  448. * @return string
  449. */
  450. public function toString($object);
  451. /**
  452. * @param \Sonata\Adminbundle\Translator\LabelTranslatorStrategyInterface $labelTranslatorStrategy
  453. */
  454. public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy);
  455. /**
  456. * @return \Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface
  457. */
  458. public function getLabelTranslatorStrategy();
  459. /**
  460. * Returning true will enable preview mode for
  461. * the target entity and show a preview button
  462. * when editing/creating an entity
  463. *
  464. * @return boolean
  465. */
  466. public function supportsPreviewMode();
  467. /**
  468. * add an Admin child to the current one
  469. *
  470. * @param \Sonata\AdminBundle\Admin\AdminInterface $child
  471. *
  472. * @return void
  473. */
  474. public function addChild(AdminInterface $child);
  475. /**
  476. * Returns true or false if an Admin child exists for the given $code
  477. *
  478. * @param string $code Admin code
  479. *
  480. * @return bool True if child exist, false otherwise
  481. */
  482. public function hasChild($code);
  483. /**
  484. * Returns an collection of admin children
  485. *
  486. * @return array list of Admin children
  487. */
  488. public function getChildren();
  489. /**
  490. * Returns an admin child with the given $code
  491. *
  492. * @param string $code
  493. *
  494. * @return array|null
  495. */
  496. public function getChild($code);
  497. /**
  498. * @return mixed a new object instance
  499. */
  500. public function getNewInstance();
  501. /**
  502. * @param string $uniqId
  503. *
  504. * @return mixed
  505. */
  506. public function setUniqid($uniqId);
  507. /**
  508. * Returns the uniqid
  509. *
  510. * @return integer
  511. */
  512. public function getUniqid();
  513. /**
  514. * @param mixed $id
  515. *
  516. * @return mixed
  517. */
  518. public function getObject($id);
  519. /**
  520. * @param string $subject
  521. *
  522. * @return mixed
  523. */
  524. public function setSubject($subject);
  525. /**
  526. * @return mixed
  527. */
  528. public function getSubject();
  529. /**
  530. * Returns a list FieldDescription
  531. *
  532. * @param string $name
  533. *
  534. * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface
  535. */
  536. public function getListFieldDescription($name);
  537. /**
  538. * Returns true if the list FieldDescription exists
  539. *
  540. * @param string $name
  541. *
  542. * @return bool
  543. */
  544. public function hasListFieldDescription($name);
  545. /**
  546. * Returns the collection of list FieldDescriptions
  547. *
  548. * @return array
  549. */
  550. public function getListFieldDescriptions();
  551. /**
  552. * Returns the array of allowed export formats
  553. *
  554. * @return array
  555. */
  556. public function getExportFormats();
  557. /**
  558. * Returns SourceIterator
  559. *
  560. * @return \Exporter\Source\SourceIteratorInterface
  561. */
  562. public function getDataSourceIterator();
  563. /**
  564. * @return void
  565. */
  566. public function configure();
  567. /**
  568. * @param mixed $object
  569. *
  570. * @return mixed
  571. */
  572. public function update($object);
  573. /**
  574. * @param mixed $object
  575. *
  576. * @return mixed
  577. */
  578. public function create($object);
  579. /**
  580. * @param mixed $object
  581. *
  582. * @return mixed
  583. */
  584. public function delete($object);
  585. /**
  586. * @param mixed $object
  587. *
  588. * @return mixed
  589. */
  590. public function preUpdate($object);
  591. /**
  592. * @param mixed $object
  593. *
  594. * @return mixed
  595. */
  596. public function postUpdate($object);
  597. /**
  598. * @param mixed $object
  599. *
  600. * @return mixed
  601. */
  602. public function prePersist($object);
  603. /**
  604. * @param mixed $object
  605. *
  606. * @return mixed
  607. */
  608. public function postPersist($object);
  609. /**
  610. * @param mixed $object
  611. *
  612. * @return mixed
  613. */
  614. public function preRemove($object);
  615. /**
  616. * @param mixed $object
  617. *
  618. * @return mixed
  619. */
  620. public function postRemove($object);
  621. /**
  622. * Call before the batch action, allow you to alter the query and the idx
  623. *
  624. * @param string $actionName
  625. * @param ProxyQueryInterface $query
  626. * @param array $idx
  627. * @param bool $allElements
  628. */
  629. public function preBatchAction($actionName, ProxyQueryInterface $query, array & $idx, $allElements);
  630. /**
  631. * Return array of filter parameters.
  632. *
  633. * @return array
  634. */
  635. public function getFilterParameters();
  636. /**
  637. * Return true if the Admin is related to a subject
  638. *
  639. * @return boolean
  640. */
  641. public function hasSubject();
  642. /**
  643. *
  644. * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement
  645. * @param mixed $object
  646. *
  647. * @return void
  648. *
  649. * @deprecated this feature cannot be stable, use a custom validator,
  650. * the feature will be removed with Symfony 2.2
  651. */
  652. public function validate(ErrorElement $errorElement, $object);
  653. /**
  654. * @param string $context
  655. *
  656. * @return boolean
  657. */
  658. public function showIn($context);
  659. /**
  660. * Add object security, fe. make the current user owner of the object
  661. *
  662. * @param mixed $object
  663. */
  664. public function createObjectSecurity($object);
  665. /**
  666. * @return AdminInterface
  667. */
  668. public function getParent();
  669. /**
  670. * @param AdminInterface $admin
  671. *
  672. * @return void
  673. */
  674. public function setParent(AdminInterface $admin);
  675. /**
  676. * Returns true if the Admin class has an Parent Admin defined
  677. *
  678. * @return boolean
  679. */
  680. public function isChild();
  681. /**
  682. * Returns template
  683. *
  684. * @param string $name
  685. *
  686. * @return null|string
  687. */
  688. public function getTemplate($name);
  689. /**
  690. * Set the translation domain
  691. *
  692. * @param string $translationDomain the translation domain
  693. *
  694. * @return void
  695. */
  696. public function setTranslationDomain($translationDomain);
  697. /**
  698. * Returns the translation domain
  699. *
  700. * @return string the translation domain
  701. */
  702. public function getTranslationDomain();
  703. /**
  704. * Return the form groups
  705. *
  706. * @return array
  707. */
  708. public function getFormGroups();
  709. /**
  710. * Set the form groups
  711. *
  712. * @param array $formGroups
  713. */
  714. public function setFormGroups(array $formGroups);
  715. /**
  716. * {@inheritdoc}
  717. */
  718. public function getFormTabs();
  719. /**
  720. * {@inheritdoc}
  721. */
  722. public function setFormTabs(array $formTabs);
  723. /**
  724. * {@inheritdoc}
  725. */
  726. public function getShowTabs();
  727. /**
  728. * {@inheritdoc}
  729. */
  730. public function setShowTabs(array $showTabs);
  731. /**
  732. * Remove a form group field
  733. *
  734. * @param $key
  735. *
  736. * @return void
  737. */
  738. public function removeFieldFromFormGroup($key);
  739. /**
  740. * Returns the show groups
  741. *
  742. * @return array
  743. */
  744. public function getShowGroups();
  745. /**
  746. * Set the show groups
  747. *
  748. * @param array $showGroups
  749. */
  750. public function setShowGroups(array $showGroups);
  751. /**
  752. * Reorder items in showGroup
  753. *
  754. * @param string $group
  755. * @param array $keys
  756. */
  757. public function reorderShowGroup($group, array $keys);
  758. /**
  759. * add a FieldDescription
  760. *
  761. * @param string $name
  762. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  763. *
  764. * @return void
  765. */
  766. public function addFormFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  767. /**
  768. * Remove a FieldDescription
  769. *
  770. * @param string $name
  771. *
  772. * @return void
  773. */
  774. public function removeFormFieldDescription($name);
  775. /**
  776. * Returns true if this admin uses ACL
  777. *
  778. * @return boolean
  779. */
  780. public function isAclEnabled();
  781. /**
  782. * Sets the list of supported sub classes
  783. *
  784. * @param array $subClasses the list of sub classes
  785. */
  786. public function setSubClasses(array $subClasses);
  787. /**
  788. * Returns true if the admin has the sub classes
  789. *
  790. * @param string $name The name of the sub class
  791. *
  792. * @return bool
  793. */
  794. public function hasSubClass($name);
  795. /**
  796. * Returns true if a subclass is currently active
  797. *
  798. * @return bool
  799. */
  800. public function hasActiveSubClass();
  801. /**
  802. * Returns the currently active sub class
  803. *
  804. * @return string the active sub class
  805. */
  806. public function getActiveSubClass();
  807. /**
  808. * Returns the currently active sub class code
  809. *
  810. * @return string the code for active sub class
  811. */
  812. public function getActiveSubclassCode();
  813. /**
  814. * Returns the list of batchs actions
  815. *
  816. * @return array the list of batchs actions
  817. */
  818. public function getBatchActions();
  819. /**
  820. * Returns Admin`s label
  821. *
  822. * @return string
  823. */
  824. public function getLabel();
  825. /**
  826. * Returns an array of persistent parameters
  827. *
  828. * @return array
  829. */
  830. public function getPersistentParameters();
  831. /**
  832. * Get breadcrumbs for $action
  833. *
  834. * @param string $action
  835. *
  836. * @return array
  837. */
  838. public function getBreadcrumbs($action);
  839. /**
  840. * Set the current child status
  841. *
  842. * @param boolean $currentChild
  843. */
  844. public function setCurrentChild($currentChild);
  845. /**
  846. * Returns the current child status
  847. *
  848. * @return bool
  849. */
  850. public function getCurrentChild();
  851. /**
  852. * Get translation label using the current TranslationStrategy.
  853. *
  854. * @param string $label
  855. * @param string $context
  856. * @param string $type
  857. *
  858. * @return string
  859. */
  860. public function getTranslationLabel($label, $context = '', $type = '');
  861. /**
  862. * DEPRECATED: Use buildTabMenu instead
  863. *
  864. * @param string $action
  865. * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
  866. *
  867. * @return \Knp\Menu\ItemInterface|boolean
  868. *
  869. * @deprecated Use buildTabMenu instead
  870. */
  871. public function buildSideMenu($action, AdminInterface $childAdmin = null);
  872. /**
  873. * Build the tab menu related to the current action
  874. *
  875. * @param string $action
  876. * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
  877. *
  878. * @return \Knp\Menu\ItemInterface|boolean
  879. */
  880. public function buildTabMenu($action, AdminInterface $childAdmin = null);
  881. /**
  882. * @param $object
  883. *
  884. * @return Metadata
  885. */
  886. public function getObjectMetadata($object);
  887. /**
  888. * @return array
  889. */
  890. public function getListModes();
  891. /**
  892. * @param string $mode
  893. */
  894. public function setListMode($mode);
  895. /**
  896. * return the list mode
  897. *
  898. * @return string
  899. */
  900. public function getListMode();
  901. }