public function __construct($itemsPerPage = 50)
 {
     parent::__construct($itemsPerPage);
     $dataColumns = $this->getComponentByType('GridFieldDataColumns');
     $dataColumns->setDisplayFields(array('Title' => 'Event', 'StartDate.Nice' => 'Start date', 'EndDate.Nice' => 'End date'));
     $sortColumns = $this->getComponentByType('GridFieldSortableHeader');
     $sortColumns->setFieldSorting(array('Title' => 'Title', 'StartDate.Nice' => 'StartDate', 'EndDate.Nice' => 'EndDate'));
 }
Example #2
0
 /**
  * @return GridFieldConfig
  */
 public function getLumberjackGridFieldConfig()
 {
     $config = GridFieldConfig_Lumberjack::create();
     $config->addComponent(new GridFieldVersionedOrderableRows());
     /** @var GridFieldPaginator $paginator */
     $paginator = $config->getComponentByType("GridFieldPaginator");
     $paginator->setItemsPerPage(999);
     return $config;
 }
 /**
  * This is responsible for adding the child pages tab and gridfield.
  *
  * @param FieldList $fields
  */
 public function updateCMSFields(FieldList $fields)
 {
     $excluded = $this->owner->getExcludedSiteTreeClassNames();
     if (!empty($excluded)) {
         $pages = SiteTree::get()->filter(array('ParentID' => $this->owner->ID, 'ClassName' => $excluded));
         $gridField = new GridField("ChildPages", $this->getLumberjackTitle(), $pages, GridFieldConfig_Lumberjack::create());
         $tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField);
         $fields->insertAfter($tab, 'Main');
     }
 }
Example #4
0
 /**
  * This returns the gird field config for the lumberjack gridfield.
  *
  * @return GridFieldConfig
  */
 protected function getLumberjackGridFieldConfig()
 {
     if (method_exists($this->owner, 'getLumberjackGridFieldConfig')) {
         return $this->owner->getLumberjackGridFieldConfig();
     }
     return GridFieldConfig_Lumberjack::create();
 }
 /**
  * @param null|int $itemsPerPage
  */
 public function __construct($itemsPerPage = null)
 {
     parent::__construct($itemsPerPage);
     $this->removeComponentsByType('GridFieldSiteTreeState');
     $this->addComponent(new GridFieldBlogPostState());
 }