Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804095
D250.id763.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:06 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:06 AM (4 h, 47 m)
Engine
blob
Format
Raw Data
Handle
576809
Attached To
D250: INP-1586 - Automatically update "ThemeId" field of category, when it's "Type" is changed
D250.id763.diff
View Options
Index: branches/5.2.x/core/units/categories/categories_event_handler.php
===================================================================
--- branches/5.2.x/core/units/categories/categories_event_handler.php
+++ branches/5.2.x/core/units/categories/categories_event_handler.php
@@ -1848,8 +1848,20 @@
$object->setRequired('PageCacheKey', $object->GetDBField('OverridePageCacheKey'));
$object->SetDBField('Template', $this->_stripTemplateExtension( $object->GetDBField('Template') ));
- if ($object->GetDBField('Type') == PAGE_TYPE_TEMPLATE) {
- if (!$this->_templateFound($object->GetDBField('Template'), $object->GetDBField('ThemeId'))) {
+ $category_type = $object->GetDBField('Type');
+
+ // Changing category type would associate/disassociate it to theme.
+ if ( $category_type != $object->GetOriginalField('Type') ) {
+ if ( $category_type == PAGE_TYPE_TEMPLATE ) {
+ $object->SetDBField('ThemeId', $this->_getCurrentThemeId());
+ }
+ else {
+ $object->SetDBField('ThemeId', 0);
+ }
+ }
+
+ if ( $category_type == PAGE_TYPE_TEMPLATE ) {
+ if ( !$this->_templateFound($object->GetDBField('Template'), $object->GetDBField('ThemeId')) ) {
$object->SetError('Template', 'template_file_missing', 'la_error_TemplateFileMissing');
}
}
Event Timeline
Log In to Comment