mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Only lazy load categories dropdown if there is a large number of categories
This commit is contained in:
parent
4a21824247
commit
39ba0e5bfd
@ -312,6 +312,11 @@ class BlogPost extends Page
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$shouldLazyLoadCategories = true;
|
||||||
|
if($this->Categories()->count() < 15) {
|
||||||
|
$shouldLazyLoadCategories = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Get categories and tags
|
// Get categories and tags
|
||||||
// @todo: Reimplement the sidebar
|
// @todo: Reimplement the sidebar
|
||||||
// $options = BlogAdminSidebar::create(
|
// $options = BlogAdminSidebar::create(
|
||||||
@ -326,7 +331,7 @@ class BlogPost extends Page
|
|||||||
$this->Categories()
|
$this->Categories()
|
||||||
)
|
)
|
||||||
->setCanCreate($this->canCreateCategories())
|
->setCanCreate($this->canCreateCategories())
|
||||||
->setShouldLazyLoad(true),
|
->setShouldLazyLoad($shouldLazyLoadCategories),
|
||||||
TagField::create(
|
TagField::create(
|
||||||
'Tags',
|
'Tags',
|
||||||
_t(__CLASS__ . '.Tags', 'Tags'),
|
_t(__CLASS__ . '.Tags', 'Tags'),
|
||||||
|
Loading…
Reference in New Issue
Block a user