AdminInterface.php 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  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. * @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. * NEXT_MAJOR: remove this signature
  805. * Get breadcrumbs for $action.
  806. *
  807. * @param string $action
  808. *
  809. * @return mixed array|Traversable
  810. */
  811. public function getBreadcrumbs($action);
  812. /**
  813. * Set the current child status.
  814. *
  815. * @param bool $currentChild
  816. */
  817. public function setCurrentChild($currentChild);
  818. /**
  819. * Returns the current child status.
  820. *
  821. * @return bool
  822. */
  823. public function getCurrentChild();
  824. /**
  825. * Get translation label using the current TranslationStrategy.
  826. *
  827. * @param string $label
  828. * @param string $context
  829. * @param string $type
  830. *
  831. * @return string
  832. */
  833. public function getTranslationLabel($label, $context = '', $type = '');
  834. /**
  835. * DEPRECATED: Use buildTabMenu instead.
  836. *
  837. * @param string $action
  838. * @param AdminInterface $childAdmin
  839. *
  840. * @return ItemInterface|bool
  841. *
  842. * @deprecated Use buildTabMenu instead
  843. */
  844. public function buildSideMenu($action, AdminInterface $childAdmin = null);
  845. /**
  846. * Build the tab menu related to the current action.
  847. *
  848. * @param string $action
  849. * @param AdminInterface $childAdmin
  850. *
  851. * @return ItemInterface|bool
  852. */
  853. public function buildTabMenu($action, AdminInterface $childAdmin = null);
  854. /**
  855. * @param $object
  856. *
  857. * @return Metadata
  858. */
  859. public function getObjectMetadata($object);
  860. /**
  861. * @return array
  862. */
  863. public function getListModes();
  864. /**
  865. * @param string $mode
  866. */
  867. public function setListMode($mode);
  868. /**
  869. * return the list mode.
  870. *
  871. * @return string
  872. */
  873. public function getListMode();
  874. /**
  875. * Return the controller access mapping.
  876. *
  877. * @return array
  878. */
  879. public function getAccessMapping();
  880. /**
  881. * Hook to handle access authorization.
  882. *
  883. * @param string $action
  884. * @param object $object
  885. */
  886. public function checkAccess($action, $object = null);
  887. /*
  888. * Configure buttons for an action
  889. *
  890. * @param string $action
  891. * @param object $object
  892. *
  893. */
  894. // public function configureActionButtons($action, $object = null);
  895. // TODO: uncomment this method for next major release
  896. // /**
  897. // * Hook to handle access authorization, without throw Exception
  898. // *
  899. // * @param string $action
  900. // * @param object $object
  901. // *
  902. // * @return bool
  903. // */
  904. // public function hasAccess($action, $object = null);
  905. //TODO: uncomment this method for 4.0
  906. /*
  907. * Returns the result link for an object.
  908. *
  909. * @param mixed $object
  910. *
  911. * @return string|null
  912. */
  913. //public function getSearchResultLink($object)
  914. // TODO: uncomment this method in 4.0
  915. // /**
  916. // * Setting to true will enable mosaic button for the admin screen.
  917. // * Setting to false will hide mosaic button for the admin screen.
  918. // *
  919. // * @param bool $isShown
  920. // */
  921. // public function showMosaicButton($isShown);
  922. }