AdminInterface.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  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\Validator\ErrorElement;
  19. use Sonata\AdminBundle\Route\RouteGeneratorInterface;
  20. use Knp\Menu\FactoryInterface as MenuFactoryInterface;
  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\FormBuilder 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 admin has a FieldDescription with the given $name
  272. *
  273. * @param string $name
  274. *
  275. * @return bool
  276. */
  277. public function hasShowFieldDescription($name);
  278. /**
  279. * add a FieldDescription
  280. *
  281. * @param string $name
  282. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  283. *
  284. * @return void
  285. */
  286. public function addShowFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  287. /**
  288. * Remove a ShowFieldDescription
  289. *
  290. * @param string $name
  291. */
  292. public function removeShowFieldDescription($name);
  293. /**
  294. * add a list FieldDescription
  295. *
  296. * @param string $name
  297. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  298. *
  299. * @return void
  300. */
  301. public function addListFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  302. /**
  303. * Remove a list FieldDescription
  304. *
  305. * @param string $name
  306. *
  307. * @return void
  308. */
  309. public function removeListFieldDescription($name);
  310. /**
  311. * Returns true if the filter FieldDescription exists
  312. *
  313. * @param string $name
  314. *
  315. * @return bool
  316. */
  317. public function hasFilterFieldDescription($name);
  318. /**
  319. * add a filter FieldDescription
  320. *
  321. * @param string $name
  322. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  323. *
  324. * @return void
  325. */
  326. public function addFilterFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  327. /**
  328. * Remove a filter FieldDescription
  329. *
  330. * @param string $name
  331. */
  332. public function removeFilterFieldDescription($name);
  333. /**
  334. * Returns the filter FieldDescription collection
  335. *
  336. * @return FieldDescriptionInterface[]
  337. */
  338. public function getFilterFieldDescriptions();
  339. /**
  340. * Returns a filter FieldDescription
  341. *
  342. * @param string $name
  343. *
  344. * @return array|null
  345. */
  346. public function getFilterFieldDescription($name);
  347. /**
  348. * Returns a list depend on the given $object
  349. *
  350. * @return \Sonata\AdminBundle\Admin\FieldDescriptionCollection
  351. */
  352. public function getList();
  353. /**
  354. * @param \Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface $securityHandler
  355. *
  356. * @return void
  357. */
  358. public function setSecurityHandler(SecurityHandlerInterface $securityHandler);
  359. /**
  360. * @return \Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface|null
  361. */
  362. public function getSecurityHandler();
  363. /**
  364. * @param string $name
  365. * @param object|null $object
  366. *
  367. * @return boolean
  368. */
  369. public function isGranted($name, $object = null);
  370. /**
  371. * @param mixed $entity
  372. */
  373. public function getUrlsafeIdentifier($entity);
  374. /**
  375. * @param mixed $entity
  376. */
  377. public function getNormalizedIdentifier($entity);
  378. /**
  379. * Shorthand method for templating
  380. *
  381. * @param object $entity
  382. *
  383. * @return mixed
  384. */
  385. public function id($entity);
  386. /**
  387. * @param \Symfony\Component\Validator\ValidatorInterface $validator
  388. *
  389. * @return void
  390. */
  391. public function setValidator(ValidatorInterface $validator);
  392. /**
  393. * @return \Symfony\Component\Validator\ValidatorInterface
  394. */
  395. public function getValidator();
  396. /**
  397. * @return array
  398. */
  399. public function getShow();
  400. /**
  401. * @param array $formTheme
  402. *
  403. * @return void
  404. */
  405. public function setFormTheme(array $formTheme);
  406. /**
  407. * @return array
  408. */
  409. public function getFormTheme();
  410. /**
  411. * @param array $filterTheme
  412. *
  413. * @return void
  414. */
  415. public function setFilterTheme(array $filterTheme);
  416. /**
  417. * @return array
  418. */
  419. public function getFilterTheme();
  420. /**
  421. * @param AdminExtensionInterface $extension
  422. *
  423. * @return void
  424. */
  425. public function addExtension(AdminExtensionInterface $extension);
  426. /**
  427. * Returns an array of extension related to the current Admin
  428. *
  429. * @return AdminExtensionInterface[]
  430. */
  431. public function getExtensions();
  432. /**
  433. * @param \Knp\Menu\FactoryInterface $menuFactory
  434. *
  435. * @return void
  436. */
  437. public function setMenuFactory(MenuFactoryInterface $menuFactory);
  438. /**
  439. * @return \Knp\Menu\FactoryInterface
  440. */
  441. public function getMenuFactory();
  442. /**
  443. * @param \Sonata\AdminBundle\Builder\RouteBuilderInterface $routeBuilder
  444. */
  445. public function setRouteBuilder(RouteBuilderInterface $routeBuilder);
  446. /**
  447. * @return \Sonata\AdminBundle\Builder\RouteBuilderInterface
  448. */
  449. public function getRouteBuilder();
  450. /**
  451. * @param mixed $object
  452. *
  453. * @return string
  454. */
  455. public function toString($object);
  456. /**
  457. * @param \Sonata\Adminbundle\Translator\LabelTranslatorStrategyInterface $labelTranslatorStrategy
  458. */
  459. public function setLabelTranslatorStrategy(LabelTranslatorStrategyInterface $labelTranslatorStrategy);
  460. /**
  461. * @return \Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface
  462. */
  463. public function getLabelTranslatorStrategy();
  464. /**
  465. * Returning true will enable preview mode for
  466. * the target entity and show a preview button
  467. * when editing/creating an entity
  468. *
  469. * @return boolean
  470. */
  471. public function supportsPreviewMode();
  472. /**
  473. * add an Admin child to the current one
  474. *
  475. * @param \Sonata\AdminBundle\Admin\AdminInterface $child
  476. *
  477. * @return void
  478. */
  479. public function addChild(AdminInterface $child);
  480. /**
  481. * Returns true or false if an Admin child exists for the given $code
  482. *
  483. * @param string $code Admin code
  484. *
  485. * @return bool True if child exist, false otherwise
  486. */
  487. public function hasChild($code);
  488. /**
  489. * Returns an collection of admin children
  490. *
  491. * @return array list of Admin children
  492. */
  493. public function getChildren();
  494. /**
  495. * Returns an admin child with the given $code
  496. *
  497. * @param string $code
  498. *
  499. * @return AdminInterface|null
  500. */
  501. public function getChild($code);
  502. /**
  503. * @return mixed a new object instance
  504. */
  505. public function getNewInstance();
  506. /**
  507. * @param string $uniqId
  508. *
  509. * @return mixed
  510. */
  511. public function setUniqid($uniqId);
  512. /**
  513. * Returns the uniqid
  514. *
  515. * @return integer
  516. */
  517. public function getUniqid();
  518. /**
  519. * @param mixed $id
  520. *
  521. * @return mixed
  522. */
  523. public function getObject($id);
  524. /**
  525. * @param object $subject
  526. *
  527. * @return mixed
  528. */
  529. public function setSubject($subject);
  530. /**
  531. * @return mixed
  532. */
  533. public function getSubject();
  534. /**
  535. * Returns a list FieldDescription
  536. *
  537. * @param string $name
  538. *
  539. * @return \Sonata\AdminBundle\Admin\FieldDescriptionInterface
  540. */
  541. public function getListFieldDescription($name);
  542. /**
  543. * Returns true if the list FieldDescription exists
  544. *
  545. * @param string $name
  546. *
  547. * @return bool
  548. */
  549. public function hasListFieldDescription($name);
  550. /**
  551. * Returns the collection of list FieldDescriptions
  552. *
  553. * @return array
  554. */
  555. public function getListFieldDescriptions();
  556. /**
  557. * Returns the array of allowed export formats
  558. *
  559. * @return array
  560. */
  561. public function getExportFormats();
  562. /**
  563. * Returns SourceIterator
  564. *
  565. * @return \Exporter\Source\SourceIteratorInterface
  566. */
  567. public function getDataSourceIterator();
  568. /**
  569. * @return void
  570. */
  571. public function configure();
  572. /**
  573. * @param mixed $object
  574. *
  575. * @return mixed
  576. */
  577. public function update($object);
  578. /**
  579. * @param mixed $object
  580. *
  581. * @return mixed
  582. */
  583. public function create($object);
  584. /**
  585. * @param mixed $object
  586. *
  587. * @return mixed
  588. */
  589. public function delete($object);
  590. /**
  591. * @param mixed $object
  592. *
  593. * @return mixed
  594. */
  595. public function preUpdate($object);
  596. /**
  597. * @param mixed $object
  598. *
  599. * @return mixed
  600. */
  601. public function postUpdate($object);
  602. /**
  603. * @param mixed $object
  604. *
  605. * @return mixed
  606. */
  607. public function prePersist($object);
  608. /**
  609. * @param mixed $object
  610. *
  611. * @return mixed
  612. */
  613. public function postPersist($object);
  614. /**
  615. * @param mixed $object
  616. *
  617. * @return mixed
  618. */
  619. public function preRemove($object);
  620. /**
  621. * @param mixed $object
  622. *
  623. * @return mixed
  624. */
  625. public function postRemove($object);
  626. /**
  627. * Call before the batch action, allow you to alter the query and the idx
  628. *
  629. * @param string $actionName
  630. * @param ProxyQueryInterface $query
  631. * @param array $idx
  632. * @param bool $allElements
  633. */
  634. public function preBatchAction($actionName, ProxyQueryInterface $query, array & $idx, $allElements);
  635. /**
  636. * Return array of filter parameters.
  637. *
  638. * @return array
  639. */
  640. public function getFilterParameters();
  641. /**
  642. * Return true if the Admin is related to a subject
  643. *
  644. * @return boolean
  645. */
  646. public function hasSubject();
  647. /**
  648. *
  649. * @param \Sonata\AdminBundle\Validator\ErrorElement $errorElement
  650. * @param mixed $object
  651. *
  652. * @return void
  653. *
  654. * @deprecated this feature cannot be stable, use a custom validator,
  655. * the feature will be removed with Symfony 2.2
  656. */
  657. public function validate(ErrorElement $errorElement, $object);
  658. /**
  659. * @param string $context
  660. *
  661. * @return boolean
  662. */
  663. public function showIn($context);
  664. /**
  665. * Add object security, fe. make the current user owner of the object
  666. *
  667. * @param mixed $object
  668. */
  669. public function createObjectSecurity($object);
  670. /**
  671. * @return AdminInterface
  672. */
  673. public function getParent();
  674. /**
  675. * @param AdminInterface $admin
  676. *
  677. * @return void
  678. */
  679. public function setParent(AdminInterface $admin);
  680. /**
  681. * Returns true if the Admin class has an Parent Admin defined
  682. *
  683. * @return boolean
  684. */
  685. public function isChild();
  686. /**
  687. * Returns template
  688. *
  689. * @param string $name
  690. *
  691. * @return null|string
  692. */
  693. public function getTemplate($name);
  694. /**
  695. * Set the translation domain
  696. *
  697. * @param string $translationDomain the translation domain
  698. *
  699. * @return void
  700. */
  701. public function setTranslationDomain($translationDomain);
  702. /**
  703. * Returns the translation domain
  704. *
  705. * @return string the translation domain
  706. */
  707. public function getTranslationDomain();
  708. /**
  709. * Return the form groups
  710. *
  711. * @return array
  712. */
  713. public function getFormGroups();
  714. /**
  715. * Set the form groups
  716. *
  717. * @param array $formGroups
  718. */
  719. public function setFormGroups(array $formGroups);
  720. /**
  721. * {@inheritdoc}
  722. */
  723. public function getFormTabs();
  724. /**
  725. * {@inheritdoc}
  726. */
  727. public function setFormTabs(array $formTabs);
  728. /**
  729. * {@inheritdoc}
  730. */
  731. public function getShowTabs();
  732. /**
  733. * {@inheritdoc}
  734. */
  735. public function setShowTabs(array $showTabs);
  736. /**
  737. * Remove a form group field
  738. *
  739. * @param string $key
  740. *
  741. * @return void
  742. */
  743. public function removeFieldFromFormGroup($key);
  744. /**
  745. * Returns the show groups
  746. *
  747. * @return array
  748. */
  749. public function getShowGroups();
  750. /**
  751. * Set the show groups
  752. *
  753. * @param array $showGroups
  754. */
  755. public function setShowGroups(array $showGroups);
  756. /**
  757. * Reorder items in showGroup
  758. *
  759. * @param string $group
  760. * @param array $keys
  761. */
  762. public function reorderShowGroup($group, array $keys);
  763. /**
  764. * add a FieldDescription
  765. *
  766. * @param string $name
  767. * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  768. *
  769. * @return void
  770. */
  771. public function addFormFieldDescription($name, FieldDescriptionInterface $fieldDescription);
  772. /**
  773. * Remove a FieldDescription
  774. *
  775. * @param string $name
  776. *
  777. * @return void
  778. */
  779. public function removeFormFieldDescription($name);
  780. /**
  781. * Returns true if this admin uses ACL
  782. *
  783. * @return boolean
  784. */
  785. public function isAclEnabled();
  786. /**
  787. * Sets the list of supported sub classes
  788. *
  789. * @param array $subClasses the list of sub classes
  790. */
  791. public function setSubClasses(array $subClasses);
  792. /**
  793. * Returns true if the admin has the sub classes
  794. *
  795. * @param string $name The name of the sub class
  796. *
  797. * @return bool
  798. */
  799. public function hasSubClass($name);
  800. /**
  801. * Returns true if a subclass is currently active
  802. *
  803. * @return bool
  804. */
  805. public function hasActiveSubClass();
  806. /**
  807. * Returns the currently active sub class
  808. *
  809. * @return string the active sub class
  810. */
  811. public function getActiveSubClass();
  812. /**
  813. * Returns the currently active sub class code
  814. *
  815. * @return string the code for active sub class
  816. */
  817. public function getActiveSubclassCode();
  818. /**
  819. * Returns the list of batchs actions
  820. *
  821. * @return array the list of batchs actions
  822. */
  823. public function getBatchActions();
  824. /**
  825. * Returns Admin`s label
  826. *
  827. * @return string
  828. */
  829. public function getLabel();
  830. /**
  831. * Returns an array of persistent parameters
  832. *
  833. * @return array
  834. */
  835. public function getPersistentParameters();
  836. /**
  837. * Get breadcrumbs for $action
  838. *
  839. * @param string $action
  840. *
  841. * @return array
  842. */
  843. public function getBreadcrumbs($action);
  844. /**
  845. * Set the current child status
  846. *
  847. * @param boolean $currentChild
  848. */
  849. public function setCurrentChild($currentChild);
  850. /**
  851. * Returns the current child status
  852. *
  853. * @return bool
  854. */
  855. public function getCurrentChild();
  856. /**
  857. * Get translation label using the current TranslationStrategy.
  858. *
  859. * @param string $label
  860. * @param string $context
  861. * @param string $type
  862. *
  863. * @return string
  864. */
  865. public function getTranslationLabel($label, $context = '', $type = '');
  866. /**
  867. * DEPRECATED: Use buildTabMenu instead
  868. *
  869. * @param string $action
  870. * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
  871. *
  872. * @return \Knp\Menu\ItemInterface|boolean
  873. *
  874. * @deprecated Use buildTabMenu instead
  875. */
  876. public function buildSideMenu($action, AdminInterface $childAdmin = null);
  877. /**
  878. * Build the tab menu related to the current action
  879. *
  880. * @param string $action
  881. * @param \Sonata\AdminBundle\Admin\AdminInterface $childAdmin
  882. *
  883. * @return \Knp\Menu\ItemInterface|boolean
  884. */
  885. public function buildTabMenu($action, AdminInterface $childAdmin = null);
  886. /**
  887. * @param $object
  888. *
  889. * @return Metadata
  890. */
  891. public function getObjectMetadata($object);
  892. /**
  893. * @return array
  894. */
  895. public function getListModes();
  896. /**
  897. * @param string $mode
  898. */
  899. public function setListMode($mode);
  900. /**
  901. * return the list mode
  902. *
  903. * @return string
  904. */
  905. public function getListMode();
  906. }