Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F805169
custom
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
Thu, Feb 27, 12:03 AM
Size
6 KB
Mime Type
text/x-diff
Expires
Sat, Mar 1, 12:03 AM (5 h, 3 m)
Engine
blob
Format
Raw Data
Handle
577398
Attached To
rMCUS Modules.Custom
custom
View Options
Index: branches/1.1.x/units/sections/sections_config.php
===================================================================
--- branches/1.1.x/units/sections/sections_config.php (revision 14035)
+++ branches/1.1.x/units/sections/sections_config.php (revision 14036)
@@ -1,95 +1,107 @@
<?php
/**
* Custom-sections prefix
*
* @author dmitrya
* @package Custom (Development Kit)
*/
defined('FULL_PATH') or die('restricted access!');
$config = Array (
'Prefix' => 'custom-sections',
'ConfigPriority' => 2,
# Event handler class used for HOOKing to existing events (ie. )
'EventHandlerClass' => Array ('class' => 'CustomEventHandler', 'file' => 'custom_eh.php', 'build_event' => 'OnBuild'),
# Defined to draw new sections (if any) in left nav. tree, normally each unit has it's own Tag Processor
'TagProcessorClass' => Array ('class' => 'kDBTagProcessor', 'file' => '', 'build_event' => 'OnBuild'),
# Extend/override already existing classes (ie. Event Handlers, Tag Processors, Helpers)
'RegisterClasses' => Array (
# extend default User core/units/users/users_tag_processor.php / users_event_handler.php
// Array ('pseudo' => 'u_TagProcessor', 'class' => 'EUserTagProcessor', 'file' => 'e_user_tp.php'),
// Array ('pseudo' => 'u_EventHandler', 'class' => 'EUserEventHandler', 'file' => 'e_user_eh.php'),
# extend default Product classes /in-commerce/units/products/products_tag_processor.php / products_event_handler.php
// Array ('pseudo' => 'p_TagProcessor', 'class' => 'EProductTagProcessor', 'file' => 'e_product_tp.php'),
// Array ('pseudo' => 'p_EventHandler', 'class' => 'EProductEventHandler', 'file' => 'e_product_eh.php'),
# extend default Link /in-link/units/links/link_tag_processor.php / links_event_handler.php
// Array ('pseudo' => 'l_TagProcessor', 'class' => 'ELinkTagProcessor', 'file' => 'e_link_tp.php'),
// Array ('pseudo' => 'l_EventHandler', 'class' => 'ELinkEventHandler', 'file' => 'e_link_eh.php'),
-
+
# extend default Category /core/units/categories/categories_tag_processor.php / categories_event_handler.php
// Array ('pseudo' => 'c_TagProcessor', 'class' => 'ECategoryTagProcessor', 'file' => 'e_category_tp.php'),
// Array ('pseudo' => 'c_EventHandler', 'class' => 'ECategoryEventHandler', 'file' => 'e_category_eh.php'),
-
+
# extend default Article /in-news/units/articles/article_tag_processor.php / articles_event_handler.php
// Array ('pseudo' => 'n_TagProcessor', 'class' => 'EArticleTagProcessor', 'file' => 'e_article_tp.php'),
// Array ('pseudo' => 'n_EventHandler', 'class' => 'EArticleEventHandler', 'file' => 'e_article_eh.php'),
-// Array ('pseudo' => 'n-rev_EventHandler', 'class' => 'EReviewEventHandler', 'file' => 'e_review_eh.php'),
-
+
),
# Replace/substiture any admin default templates with custom ones
'ReplacementTemplates' => Array (
# replace default image block with custom template
// 'incs/image_blocks' => 'custom/incs/image_blocks',
# replace default edit link template
// 'in-links/links/links_edit' => 'custom/links/links_edit',
# replace default edit category template
// 'categories/categories_edit' => 'custom/categories/categories_edit',
),
# Hooks to events that may call any other events
'Hooks' => Array (
-
+
+ # hook to OnAfterCacheRebuild event of "adm" prefix (tiggered when unit cache is rebuild and stored) called
+ # to override cloned sub-items (ie. register extended classes for cloned unit configs such as n-img, n-rev)
+ /*Array (
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'adm',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterCacheRebuild'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnOverrideClonedSubItems',
+ ),*/
+
# hook to category OnAfterConfigRead event called to customize category configuration settings
/*Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => 'c',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
'DoPrefix' => '',
'DoSpecial' => '*',
'DoEvent' => 'OnModifyCategoriesConfig',
),*/
),
'PermSection' => Array ('main' => 'custom', 'email' => 'custom:configuration_email'),
# New sections in left navigation
/*'Sections' => Array (
'custom' => Array (
'parent' => 'in-portal:root',
'icon' => 'conf_custom',
'label' => 'la_title_Custom',
'url' => Array ('t' => 'index', 'pass' => 'm'),
'permissions' => Array ('view'),
'priority' => 2.4,
'container' => true,
'type' => stTREE,
),
),*/
);
\ No newline at end of file
Index: branches/1.1.x/units/sections/custom_eh.php
===================================================================
--- branches/1.1.x/units/sections/custom_eh.php (revision 14035)
+++ branches/1.1.x/units/sections/custom_eh.php (revision 14036)
@@ -1,39 +1,50 @@
<?php
defined('FULL_PATH') or die('restricted access!');
/**
* Custom event handler class
*
*/
class CustomEventHandler extends kEventHandler {
/**
* Connection to database
*
* @var kDBConnection
* @access public
*/
var $Conn;
function CustomEventHandler()
{
parent::kBase();
$this->Conn =& $this->Application->GetADODBConnection();
}
/**
+ * [HOOK] Override cloned sub-items (ie. register extended classes for clones from Reviews, Images)
+ *
+ * @param kEvent $event
+ */
+ function OnOverrideClonedSubItems(&$event)
+ {
+ # register EReviewEventHandler class as extented from cloned ReviewEventHandler for article reviews ("n" prefix)
+// $this->Application->registerClass('EReviewEventHandler', dirname(__FILE__) . '/e_review_eh.php', 'n-rev_EventHandler');
+ }
+
+ /**
* [HOOK] Modify config stored in "categories_config.php" without extending CategoriesEventHandler class
*
* @param kEvent $event
*/
function OnModifyCategoriesConfig(&$event)
{
# get Fields configuration from /core/units/categories/categories_config.php
$fields = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Fields');
# set configuration fields
$this->Application->setUnitOption($event->MasterEvent->Prefix, 'Fields', $fields);
}
}
\ No newline at end of file
Event Timeline
Log In to Comment