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

55 lines
989 B
PHP
Raw Normal View History

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