Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Is not created new page type


Go to End


423 Views

Avatar
Polik88

Community Member, 1 Post

8 March 2017 at 12:21am

Edited: 08/03/2017 12:26am

A new page type is not created. My code:

<?php
/**
 * Defines the SimplePage page type
 */
class SimplePage extends Page {
	public $image_sizes = array(
		'qatestlab' => array(
			'AnonsImage'	=>	array('x'=>83, 'y'=>83, 'fn'=>'SetCroppedSize'),
		),
		'web100' => array(
			'AnonsImage'	=>	array('x'=>300, 'y'=>130, 'fn'=>'SetCroppedSize'),
		),
	);

	static $default_sort = 'Created DESC';

	function getCMSFields() {
		$fields = parent::getCMSFields();

		$img_field = $fields->dataFieldByName('BigAnonsImage');
		$img_field->SetSizes(array('x'=>200, 'y'=>136, 'fn'=>'SetCroppedSize'));
		$img_field->setTitle('Will be displayed on the page itself: <a target="_blank" href="/'.$this->owner->Link().'/">'.$this->owner->ClassName.'</a>');
		return $fields;
	}
}

class SimplePage_Controller extends Page_Controller {
	function EditURL(){
		return "/admin/pages/show/".$this->ID."/";
	}

}

Next I do site.com/dev/build and site.com?flush=all But there is no new page type in the admin panel and in the database