mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
FIX refactored to remove code from _config.php
This commit is contained in:
parent
e6cf037369
commit
d9d5c01be3
@ -1,8 +1 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fetches the name of the current module folder name.
|
||||
*
|
||||
* @return string
|
||||
**/
|
||||
define('BLOGGER_DIR', basename(dirname(__FILE__)));
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace SilverStripe\Blog\Forms\GridField;
|
||||
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use UnexpectedValueException;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Core\Convert;
|
||||
@ -155,7 +156,7 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
|
||||
*/
|
||||
public function getHTMLFragments($gridField)
|
||||
{
|
||||
Requirements::javascript(BLOGGER_DIR . '/js/gridfieldaddbydbfield.js');
|
||||
Requirements::javascript(ModuleLoader::getModule('silverstripe/blog')->getRelativeResourcePath('js/gridfieldaddbydbfield.js'));
|
||||
|
||||
/**
|
||||
* @var DataList $dataList
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace SilverStripe\Blog\Forms\GridField;
|
||||
|
||||
use SilverStripe\Blog\Model\BlogPost;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Lumberjack\Forms\GridFieldSiteTreeState;
|
||||
use SilverStripe\View\Requirements;
|
||||
|
||||
@ -19,7 +20,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
|
||||
public function getColumnContent($gridField, $record, $columnName)
|
||||
{
|
||||
if ($columnName == 'State') {
|
||||
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||
Requirements::css(ModuleLoader::getModule('silverstripe/blog')->getRelativeResourcePath('css/cms.css'));
|
||||
if ($record instanceof BlogPost) {
|
||||
$modifiedLabel = '';
|
||||
|
||||
|
@ -14,6 +14,7 @@ use SilverStripe\CMS\Controllers\RootURLController;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Control\RSS\RSSFeed;
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\ListboxField;
|
||||
use SilverStripe\Forms\NumericField;
|
||||
@ -141,8 +142,9 @@ class Blog extends Page implements PermissionProvider
|
||||
*/
|
||||
public function getCMSFields()
|
||||
{
|
||||
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
|
||||
$module = ModuleLoader::getModule('silverstripe/blog');
|
||||
Requirements::css($module->getRelativeResourcePath('css/cms.css'));
|
||||
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
|
||||
|
||||
$this->beforeUpdateCMSFields(function ($fields) {
|
||||
if (!$this->canEdit()) {
|
||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\Blog\Model;
|
||||
use SilverStripe\Assets\Image;
|
||||
use SilverStripe\Blog\Forms\GridField\GridFieldConfig_BlogPost;
|
||||
use SilverStripe\Blog\Model\BlogPost;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\Tab;
|
||||
@ -107,9 +108,9 @@ class BlogMemberExtension extends DataExtension
|
||||
$fields->removeFieldFromTab('Root', 'BlogPosts');
|
||||
|
||||
// Construct a better posts tab.
|
||||
|
||||
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
|
||||
$module = ModuleLoader::getModule('silverstripe/blog');
|
||||
Requirements::css($module->getRelativeResourcePath('css/cms.css'));
|
||||
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
|
||||
|
||||
$tab = Tab::create('BlogPosts', _t(__CLASS__ . '.TABBLOGPOSTS', 'Blog Posts'));
|
||||
|
||||
|
@ -9,6 +9,7 @@ use SilverStripe\Blog\Model\BlogCategory;
|
||||
use SilverStripe\Blog\Model\BlogPostFilter;
|
||||
use SilverStripe\Blog\Model\BlogTag;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||
use SilverStripe\Forms\DatetimeField;
|
||||
use SilverStripe\Forms\HiddenField;
|
||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
||||
@ -208,8 +209,9 @@ class BlogPost extends Page
|
||||
*/
|
||||
public function getCMSFields()
|
||||
{
|
||||
Requirements::css(BLOGGER_DIR . '/css/cms.css');
|
||||
Requirements::javascript(BLOGGER_DIR . '/js/cms.js');
|
||||
$module = ModuleLoader::getModule('silverstripe/blog');
|
||||
Requirements::css($module->getRelativeResourcePath('css/cms.css'));
|
||||
Requirements::javascript($module->getRelativeResourcePath('js/cms.js'));
|
||||
|
||||
$this->beforeUpdateCMSFields(function ($fields) {
|
||||
$uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image'));
|
||||
|
Loading…
Reference in New Issue
Block a user