AdminInterface.php 24 KB

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