AdminInterface.php 25 KB

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