mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
Merge branch '4.4' into 4
This commit is contained in:
commit
8a44071ec6
@ -2369,7 +2369,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*/
|
*/
|
||||||
protected function generateHintsCacheKey($memberID)
|
protected function generateHintsCacheKey($memberID)
|
||||||
{
|
{
|
||||||
return md5($memberID . '_' . __CLASS__);
|
$baseKey = $memberID . '_' . __CLASS__;
|
||||||
|
|
||||||
|
$this->extend('updateHintsCacheKey', $baseKey);
|
||||||
|
|
||||||
|
return md5($baseKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,15 +43,26 @@ class CMSPageAddController extends CMSPageEditController
|
|||||||
public function AddForm()
|
public function AddForm()
|
||||||
{
|
{
|
||||||
$pageTypes = array();
|
$pageTypes = array();
|
||||||
|
$defaultIcon = Config::inst()->get(SiteTree::class, 'icon_class');
|
||||||
|
|
||||||
foreach ($this->PageTypes() as $type) {
|
foreach ($this->PageTypes() as $type) {
|
||||||
|
$class = $type->getField('ClassName');
|
||||||
|
$icon = Config::inst()->get($class, 'icon_class') ?: $defaultIcon;
|
||||||
|
|
||||||
|
// If the icon is the SiteTree default and there's some specific icon being provided by `getPageIconURL`
|
||||||
|
// then we don't need to add the icon class. Otherwise the class take precedence.
|
||||||
|
if ($icon === $defaultIcon && !empty(singleton($class)->getPageIconURL())) {
|
||||||
|
$icon = '';
|
||||||
|
}
|
||||||
|
|
||||||
$html = sprintf(
|
$html = sprintf(
|
||||||
'<span class="page-icon %s 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'),
|
$icon,
|
||||||
Convert::raw2htmlid($type->getField('ClassName')),
|
Convert::raw2htmlid($class),
|
||||||
$type->getField('AddAction'),
|
$type->getField('AddAction'),
|
||||||
$type->getField('Description')
|
$type->getField('Description')
|
||||||
);
|
);
|
||||||
$pageTypes[$type->getField('ClassName')] = DBField::create_field('HTMLFragment', $html);
|
$pageTypes[$class] = DBField::create_field('HTMLFragment', $html);
|
||||||
}
|
}
|
||||||
// Ensure generic page type shows on top
|
// Ensure generic page type shows on top
|
||||||
if (isset($pageTypes['Page'])) {
|
if (isset($pageTypes['Page'])) {
|
||||||
|
@ -31,6 +31,9 @@ class LeftAndMainPageIconsExtension extends Extension
|
|||||||
$css = '';
|
$css = '';
|
||||||
$classes = ClassInfo::subclassesFor(SiteTree::class);
|
$classes = ClassInfo::subclassesFor(SiteTree::class);
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
|
if (!empty(Config::inst()->get($class, 'icon_class', Config::UNINHERITED))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$iconURL = SiteTree::singleton($class)->getPageIconURL();
|
$iconURL = SiteTree::singleton($class)->getPageIconURL();
|
||||||
if ($iconURL) {
|
if ($iconURL) {
|
||||||
$cssClass = Convert::raw2htmlid($class);
|
$cssClass = Convert::raw2htmlid($class);
|
||||||
|
@ -279,7 +279,7 @@ class VirtualPage extends Page
|
|||||||
|
|
||||||
$fields->addFieldToTab("Root.Main", new LiteralField(
|
$fields->addFieldToTab("Root.Main", new LiteralField(
|
||||||
'VirtualPageMessage',
|
'VirtualPageMessage',
|
||||||
'<div class="message notice">' . implode('. ', $msgs) . '.</div>'
|
'<div class="alert alert-info">' . implode('. ', $msgs) . '.</div>'
|
||||||
), 'CopyContentFromID');
|
), 'CopyContentFromID');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user