Ejemplo n.º 1
0
 /**
  * @param Action $action
  * @param string $actionId
  * @return array|BreadCrumb[]
  */
 public function updateCrumbs(Action $action, $actionId)
 {
     $current = new BreadCrumb($action->caption(), (string) Url::relative($actionId, $this->readRawParameters($action)));
     $newCrumbs = [];
     foreach ($this->crumbs as $crumb) {
         if ($crumb == $current) {
             break;
         }
         $newCrumbs[] = $crumb;
     }
     $newCrumbs[] = $current;
     $this->crumbs = $newCrumbs;
     return $newCrumbs;
 }
Ejemplo n.º 2
0
 private function createLinks($object, $classes = '')
 {
     return array_map(function (Link $link) use($object, $classes) {
         $action = $this->actions->getAction($link->actionId());
         $parameters = $link->parameters($object);
         if ($action->isModifying() && $this->token) {
             $parameters[ExecutionResource::TOKEN_ARG] = $this->token->generate($link->actionId());
         }
         $url = (string) Url::relative($link->actionId(), $parameters);
         $attributes = ['class' => $classes, 'href' => $url];
         if ($link->confirm() !== null) {
             $attributes['onclick'] = "return confirm('{$link->confirm()}');";
         }
         $description = $action->description();
         if (!is_null($description)) {
             $attributes['title'] = str_replace('"', "'", strip_tags($this->parser->shorten($description)));
         }
         return new Element('a', $attributes, [$action->caption()]);
     }, $this->links->getLinks($object));
 }
Ejemplo n.º 3
0
 /**
  * @param ActionPanel $value
  * @return mixed
  */
 public function render($value)
 {
     $heading = $this->actions->getAction($value->getActionId())->caption();
     return (string) (new Panel($heading, $this->getContent($value)))->setMaxHeight($value->getMaxHeight())->setRightHeading([new Element('a', ['href' => (string) Url::relative($value->getActionId(), $value->getParameters())], [new Element('span', ['class' => 'glyphicon glyphicon-circle-arrow-right'])])])->render($this->renderers);
 }
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function getUrl()
 {
     return (string) Url::relative($this->target, $this->parameters);
 }
Ejemplo n.º 5
0
 public function render()
 {
     return new Element('li', [], [new Element('a', ['href' => (string) Url::relative($this->actionId, $this->parameters)], [$this->getCaption()])]);
 }