/** * @param ComponentInterface $component * * @return string */ public function generateLink(ComponentInterface $component, ActionInterface $action = null) { if (!$this->pool) { return $component->getHash(); } $admin = $this->getAdmin($component, $action); if (!$admin) { return $component->getHash(); } return sprintf('<a href="%s">%s</a>', $admin->generateObjectUrl('edit', $component->getData()), $admin->toString($component->getData())); }
/** * @param ComponentInterface $component * * @return string */ public function generateLink(ComponentInterface $component, ActionInterface $action = null) { if (!$this->pool) { return $component->getHash(); } $admin = $this->getAdmin($component, $action); if (!$admin) { return $component->getHash(); } foreach (array('edit', 'show') as $mode) { if ($admin->hasRoute($mode) && $admin->isGranted(strtoupper($mode))) { return sprintf('<a href="%s">%s</a>', $admin->generateObjectUrl($mode, $component->getData()), $admin->toString($component->getData())); } } return $admin->toString($component->getData()); }
/** * @param ComponentInterface $component component * * @return QueryBuilder */ public function addSubject(ComponentInterface $component) { $this->subjects[$component->getHash()] = $component; return $this; }
/** * @param ComponentInterface $subject subject * * @return string */ protected function getSubjectRedisKey(ComponentInterface $subject) { return sprintf('%s:%s', $this->prefix, $subject->getHash()); }
/** * {@inheritdoc} */ public function getIdent() { return $this->subject->getHash(); }