AdminInterface.php 24 KB

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