Example #1
0
 public function addLink($name, Link $link)
 {
     $link->setName($name);
     $drop_down_link = new DropDownLink();
     $drop_down_link->setLink($link);
     $this->option[self::LINKS][] = $drop_down_link;
     return $drop_down_link;
 }
Example #2
0
 public function addLinkAttr(&$button, $attr_name, Link $link)
 {
     $href = $link->create($this->data);
     if (!$link->hasUseNetteLink()) {
         $button->addAttributes(array($attr_name => reset($href)));
     } else {
         if ($href === FALSE) {
             return FALSE;
         }
         list($to_href, $params) = $href;
         $used_component = $link->getUsedComponent();
         if (!is_null($used_component)) {
             if (is_string($used_component)) {
                 $href_attribute = $this->presenter[$used_component]->link($to_href, $params);
             } elseif (is_array($used_component)) {
                 $component = $this->presenter;
                 foreach ($used_component as $component_name) {
                     $component = $component[$component_name];
                 }
                 $href_attribute = $component->link($to_href, $params);
             } else {
                 throw new Grid_Exception('Link::COMPONENT must be string or array, ' . gettype($used_component) . ' given.');
             }
             $button->addAttributes(array($attr_name => $href_attribute));
         } else {
             $button->addAttributes(array($attr_name => $this->presenter->link($to_href, $params)));
         }
     }
     return TRUE;
 }
Example #3
0
 public function getBodyAttributes($data)
 {
     if (!empty($this->option[self::ATTRIBUTES]) && is_array($this->option[self::ATTRIBUTES])) {
         foreach ($this->option[self::ATTRIBUTES] as $key => $value) {
             $this->option[self::ATTRIBUTES][$key] = Link::parseValue($value, $data);
         }
         return $this->option[self::ATTRIBUTES];
     }
     return array();
 }