AdminInterface.php 25 KB

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