silverstripe-blog/code/compat/widgets/ArchiveWidget.php

53 lines
829 B
PHP
Raw Normal View History

2015-02-08 08:03:55 +01:00
<?php
2015-05-09 16:33:12 +02:00
if(!class_exists('Widget')) {
return;
}
2015-02-08 08:03:55 +01:00
/**
* @deprecated since version 2.0
2015-05-09 16:33:12 +02:00
*
* @property string $DisplayMode
* @property string $ArchiveType
2015-02-08 08:03:55 +01:00
*/
class ArchiveWidget extends BlogArchiveWidget implements MigratableObject {
2015-05-09 16:33:12 +02:00
/**
* @var array
*/
2015-02-08 08:03:55 +01:00
private static $db = array(
2015-05-09 16:33:12 +02:00
'DisplayMode' => 'Varchar',
2015-02-08 08:03:55 +01:00
);
2015-05-09 16:33:12 +02:00
/**
* @var array
*/
private static $only_available_in = array(
'none',
);
2015-02-08 08:03:55 +01:00
2015-05-09 16:33:12 +02:00
/**
* {@inheritdoc}
*/
2015-02-08 08:03:55 +01:00
public function canCreate($member = null) {
return false;
}
2015-05-09 16:33:12 +02:00
/**
* {@inheritdoc}
*/
2015-02-08 08:03:55 +01:00
public function up() {
if($this->DisplayMode) {
2015-05-09 16:33:12 +02:00
$this->ArchiveType = 'Monthly';
if($this->DisplayMode === 'year') {
$this->ArchiveType = 'Yearly';
}
2015-02-08 08:03:55 +01:00
}
2015-05-09 16:33:12 +02:00
2015-02-08 08:03:55 +01:00
$this->ClassName = 'BlogArchiveWidget';
$this->write();
return "Migrated " . $this->ArchiveType . " archive widget";
2015-02-08 08:03:55 +01:00
}
}