/** * @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); }
/** * @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); } }
/** * @return array */ public function getRouteParameters() { return $this->element->getRouteParameters(); }
/** * @inheritdoc */ public function mount(Element $element) { if ($element instanceof DoctrineAwareInterface || $element instanceof DoctrineElement) { $element->setManagerRegistry($this->managerRegistry); } }
/** * @inheritdoc */ public function mount(Element $element) { if ($element instanceof FormAwareInterface || $element instanceof FormElement) { $element->setFormFactory($this->formFactory); } }
/** * @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']; }
/** * @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); } }