mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
NEW Add font-icon support for site tree
This commit is contained in:
parent
75f41b56d5
commit
1f1f44969a
@ -6,6 +6,7 @@ use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\Session;
|
||||
use SilverStripe\Control\HTTPResponse;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\Form;
|
||||
@ -44,7 +45,8 @@ class CMSPageAddController extends CMSPageEditController
|
||||
$pageTypes = array();
|
||||
foreach ($this->PageTypes() as $type) {
|
||||
$html = sprintf(
|
||||
'<span class="page-icon class-%s"></span><span class="title">%s</span><span class="form__field-description">%s</span>',
|
||||
'<span class="page-icon %s class-%s"></span><span class="title">%s</span><span class="form__field-description">%s</span>',
|
||||
Config::inst()->get($type->getField('ClassName'), 'icon_class'),
|
||||
Convert::raw2htmlid($type->getField('ClassName')),
|
||||
$type->getField('AddAction'),
|
||||
$type->getField('Description')
|
||||
|
@ -22,6 +22,8 @@ class RedirectorPage extends Page
|
||||
{
|
||||
private static $description = 'Redirects to an internal page or an external URL';
|
||||
|
||||
private static $icon_class = 'font-icon-p-redirect';
|
||||
|
||||
private static $db = array(
|
||||
"RedirectionType" => "Enum('Internal,External','Internal')",
|
||||
"ExternalURL" => "Varchar(2083)" // 2083 is the maximum length of a URL in Internet Explorer.
|
||||
|
@ -277,6 +277,13 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
*/
|
||||
private static $icon = null;
|
||||
|
||||
/**
|
||||
* Class attached to page icons in the CMS page tree. Also supports font-icon set.
|
||||
* @config
|
||||
* @var string
|
||||
*/
|
||||
private static $icon_class = 'font-icon-page';
|
||||
|
||||
private static $extensions = [
|
||||
Hierarchy::class,
|
||||
Versioned::class,
|
||||
@ -2747,7 +2754,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
$children = $this->creatableChildren();
|
||||
$flags = $this->getStatusFlags();
|
||||
$treeTitle = sprintf(
|
||||
"<span class=\"jstree-pageicon page-icon class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
|
||||
"<span class=\"jstree-pageicon page-icon %s class-%s\"></span><span class=\"item\" data-allowedchildren=\"%s\">%s</span>",
|
||||
$this->config()->get('icon') ? '' : $this->config()->get('icon_class'),
|
||||
Convert::raw2htmlid(static::class),
|
||||
Convert::raw2att(json_encode($children)),
|
||||
Convert::raw2xml(str_replace(array("\n","\r"), "", $this->MenuTitle))
|
||||
|
@ -29,6 +29,8 @@ class VirtualPage extends Page
|
||||
{
|
||||
private static $description = 'Displays the content of another page';
|
||||
|
||||
private static $icon_class = 'font-icon-p-virtual';
|
||||
|
||||
public static $virtualFields;
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user