/**
  * @param Controller $parentController
  * @param string $urlSegment
  * @param string $recordClass
  */
 public function __construct($parentController, $urlSegment, $recordClass = null)
 {
     $this->parentController = $parentController;
     $this->urlSegment = $urlSegment;
     if ($recordClass) {
         $this->recordClass = $recordClass;
     }
     parent::__construct();
 }
 /**
  * CMS-specific functionality: Passes through navigation breadcrumbs
  * to the template, and includes the currently edited record (if any).
  * see {@link LeftAndMain->Breadcrumbs()} for details.
  *
  * @param boolean $unlinked
  * @return ArrayList
  */
 public function Breadcrumbs($unlinked = false)
 {
     if (!$this->popupController->hasMethod('Breadcrumbs')) {
         return null;
     }
     /** @var ArrayList $items */
     $items = $this->popupController->Breadcrumbs($unlinked);
     if ($this->record && $this->record->ID) {
         $title = $this->record->Title ? $this->record->Title : "#{$this->record->ID}";
         $items->push(new ArrayData(array('Title' => $title, 'Link' => $this->Link())));
     } else {
         $items->push(new ArrayData(array('Title' => sprintf(_t('GridField.NewRecord', 'New %s'), $this->record->i18n_singular_name()), 'Link' => false)));
     }
     return $items;
 }
 /**
  * @param string $action
  * @return bool
  */
 public function checkAccessAction($action)
 {
     if (parent::checkAccessAction($action)) {
         return true;
     }
     $actions = $this->getAllActions();
     foreach ($actions as $formAction) {
         if ($formAction->actionName() === $action) {
             return true;
         }
     }
     // Always allow actions on fields
     $field = $this->checkFieldsForAction($this->Fields(), $action);
     if ($field && $field->checkAccessAction($action)) {
         return true;
     }
     return false;
 }
 /**
  * Creates a new field.
  *
  * @param string $name The internal field name, passed to forms.
  * @param null|string $title The human-readable field label.
  * @param mixed $value The value of the field.
  */
 public function __construct($name, $title = null, $value = null)
 {
     $this->setName($name);
     if ($title === null) {
         $this->title = self::name_to_label($name);
     } else {
         $this->title = $title;
     }
     if ($value !== null) {
         $this->setValue($value);
     }
     parent::__construct();
     $this->setupDefaultClasses();
 }
 /**
  * Return the class that defines the given action, so that we know where to check allowed_actions.
  * Overrides RequestHandler to also look at defined templates.
  *
  * @param string $action
  *
  * @return string
  */
 protected function definingClassForAction($action)
 {
     $definingClass = parent::definingClassForAction($action);
     if ($definingClass) {
         return $definingClass;
     }
     $class = get_class($this);
     while ($class != 'SilverStripe\\Control\\RequestHandler') {
         $templateName = strtok($class, '_') . '_' . $action;
         if (SSViewer::hasTemplate($templateName)) {
             return $class;
         }
         $class = get_parent_class($class);
     }
     return null;
 }
 public function __construct($controller, $name)
 {
     parent::__construct();
     $this->controller = $controller;
     $this->name = $name;
 }
 /**
  * @param UploadFIeld $parent
  * @param int $itemID
  */
 public function __construct($parent, $itemID)
 {
     $this->parent = $parent;
     $this->itemID = $itemID;
     parent::__construct();
 }
 public function __construct($parent, $folderName = null)
 {
     $this->parent = $parent;
     $this->folderName = $folderName;
     parent::__construct();
 }
 public function __construct($gridField, $id, $link)
 {
     $this->gridField = $gridField;
     $this->id = $id;
     $this->link = $link;
     parent::__construct();
 }
 public function testConstructedWithNullRequest()
 {
     $r = new RequestHandler();
     $this->assertInstanceOf('SilverStripe\\Control\\NullHTTPRequest', $r->getRequest());
 }