mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2364 from sachajudd/pulls/4.4/font-icon-support
NEW Add font-icon support for site tree
This commit is contained in:
commit
ba897af221
@ -6,6 +6,7 @@ use SilverStripe\CMS\Model\SiteTree;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
@ -44,7 +45,8 @@ class CMSPageAddController extends CMSPageEditController
|
|||||||
$pageTypes = array();
|
$pageTypes = array();
|
||||||
foreach ($this->PageTypes() as $type) {
|
foreach ($this->PageTypes() as $type) {
|
||||||
$html = sprintf(
|
$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')),
|
Convert::raw2htmlid($type->getField('ClassName')),
|
||||||
$type->getField('AddAction'),
|
$type->getField('AddAction'),
|
||||||
$type->getField('Description')
|
$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 $description = 'Redirects to an internal page or an external URL';
|
||||||
|
|
||||||
|
private static $icon_class = 'font-icon-p-redirect';
|
||||||
|
|
||||||
private static $db = array(
|
private static $db = array(
|
||||||
"RedirectionType" => "Enum('Internal,External','Internal')",
|
"RedirectionType" => "Enum('Internal,External','Internal')",
|
||||||
"ExternalURL" => "Varchar(2083)" // 2083 is the maximum length of a URL in Internet Explorer.
|
"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;
|
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 = [
|
private static $extensions = [
|
||||||
Hierarchy::class,
|
Hierarchy::class,
|
||||||
Versioned::class,
|
Versioned::class,
|
||||||
@ -2747,7 +2754,8 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
$children = $this->creatableChildren();
|
$children = $this->creatableChildren();
|
||||||
$flags = $this->getStatusFlags();
|
$flags = $this->getStatusFlags();
|
||||||
$treeTitle = sprintf(
|
$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::raw2htmlid(static::class),
|
||||||
Convert::raw2att(json_encode($children)),
|
Convert::raw2att(json_encode($children)),
|
||||||
Convert::raw2xml(str_replace(array("\n","\r"), "", $this->MenuTitle))
|
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 $description = 'Displays the content of another page';
|
||||||
|
|
||||||
|
private static $icon_class = 'font-icon-p-virtual';
|
||||||
|
|
||||||
public static $virtualFields;
|
public static $virtualFields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user