public function FieldList()
 {
     $items = parent::FieldList()->toArray();
     $count = 0;
     $newItems = array();
     /** @var SelectionGroup_Item $item */
     foreach ($items as $item) {
         if ($this->value == $item->getValue()) {
             $firstSelected = true;
             $checked = true;
         } else {
             $firstSelected = false;
             $checked = false;
         }
         $itemID = $this->ID() . '_' . ++$count;
         // @todo Move into SelectionGroup_Item.ss template at some point.
         $extra = array("RadioButton" => DBField::create_field('HTMLFragment', FormField::create_tag('input', array('class' => 'selector', 'type' => 'radio', 'id' => $itemID, 'name' => $this->name, 'value' => $item->getValue(), 'checked' => $checked, 'aria-labelledby' => "title-{$itemID}"))), "RadioLabel" => DBField::create_field('HTMLFragment', FormField::create_tag('label', array('id' => "title-{$itemID}", 'for' => $itemID), $item->getTitle())), "Selected" => $firstSelected);
         $newItems[] = $item->customise($extra);
     }
     return new ArrayList($newItems);
 }
 public function getHTMLFragments($gridField)
 {
     $modelClass = $gridField->getModelClass();
     $parentID = 0;
     if (!$this->currentID) {
         return null;
     }
     $modelObj = DataObject::get_by_id($modelClass, $this->currentID);
     $parent = null;
     if ($modelObj->hasMethod('getParent')) {
         $parent = $modelObj->getParent();
     } elseif ($modelObj->ParentID) {
         $parent = $modelObj->Parent();
     }
     if ($parent) {
         $parentID = $parent->ID;
     }
     // Attributes
     $attrs = array_merge($this->attributes, array('href' => sprintf($this->linkSpec, $parentID), 'class' => 'cms-panel-link ss-ui-button font-icon-level-up no-text grid-levelup'));
     $linkTag = FormField::create_tag('a', $attrs);
     $forTemplate = new ArrayData(array('UpLink' => DBField::create_field('HTMLFragment', $linkTag)));
     $template = SSViewer::get_templates_by_class($this, '', __CLASS__);
     return array('before' => $forTemplate->renderWith($template));
 }
 /**
  * @param $content
  *
  * @return string
  */
 protected function getOptionalTableFooter($content)
 {
     if ($content['footer']) {
         return FormField::create_tag('tfoot', array(), $content['footer']);
     }
     return '';
 }
 /**
  * @param array $properties
  * @return string
  */
 public function Field($properties = array())
 {
     return FormField::create_tag('input', array('type' => 'submit', 'name' => sprintf('action_%s', $this->getName()), 'value' => $this->title, 'id' => $this->ID(), 'class' => sprintf('action%s', $this->extraClass)));
 }