Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1170087
D250.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
Sat, Sep 27, 12:07 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Sun, Sep 28, 12:07 AM (8 h, 45 m)
Engine
blob
Format
Raw Data
Handle
758189
Attached To
D250: INP-1586 - Automatically update "ThemeId" field of category, when it's "Type" is changed
D250.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