Example #1
0
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\Element $element
  */
 function it_remove_element_by_id($element)
 {
     $element->getId()->willReturn('foo');
     $this->addElement($element);
     $this->hasElement('foo')->shouldReturn(true);
     $this->removeElement('foo');
     $this->hasElement('foo')->shouldReturn(false);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function mount(Element $element)
 {
     if ($element instanceof ListElement) {
         $element->setDataSourceFactory($this->dataSourceFactory);
         $element->setDataGridFactory($this->dataGridFactory);
         return;
     }
     if ($element instanceof DataSourceAwareInterface) {
         $element->setDataSourceFactory($this->dataSourceFactory);
     }
     if ($element instanceof DataGridAwareInterface) {
         $element->setDataGridFactory($this->dataGridFactory);
     }
 }
Example #3
0
 /**
  * @return array
  */
 public function getRouteParameters()
 {
     return $this->element->getRouteParameters();
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function mount(Element $element)
 {
     if ($element instanceof DoctrineAwareInterface || $element instanceof DoctrineElement) {
         $element->setManagerRegistry($this->managerRegistry);
     }
 }
Example #5
0
 /**
  * @inheritdoc
  */
 public function mount(Element $element)
 {
     if ($element instanceof FormAwareInterface || $element instanceof FormElement) {
         $element->setFormFactory($this->formFactory);
     }
 }
Example #6
0
 /**
  * @param Element $element
  * @param array $testedRouteParameters
  * @return bool
  */
 private function isRouteMatchingElementAfterSuccess(Element $element, array $testedRouteParameters)
 {
     if (!$element instanceof RedirectableElement) {
         return false;
     }
     if (!isset($testedRouteParameters['element'])) {
         return false;
     }
     $successParameters = $element->getSuccessRouteParameters();
     if (!isset($successParameters['element'])) {
         return false;
     }
     return $successParameters['element'] === $testedRouteParameters['element'];
 }
Example #7
0
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\Element $element
  * @return \FSi\Bundle\AdminBundle\Admin\Manager
  */
 public function addElement(Element $element)
 {
     $this->elements[$element->getId()] = $element;
     return $this;
 }
 /**
  * @inheritdoc
  */
 public function mount(Element $element)
 {
     if ($element instanceof RequestStackAware) {
         $element->setRequestStack($this->requestStack);
     }
 }
 public function mount(Element $element)
 {
     if ($element instanceof TranslatableAwareElement) {
         $element->setLocaleManager($this->localeManager);
     }
 }