OXID Community Forum

> International Forums > Modules > Extending oxconfig with static methods
Login
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Thread: Extending oxconfig with static methods


Reply
 
Thread Tools Search this Thread Display Modes
#Top   #1  
Old 04-04-2017, 03:18 PM
dev_ht dev_ht is offline
Junior Member
Join Date: Apr 2017
Posts: 3
dev_ht is on a distinguished road
Default Extending oxconfig with static methods

Hi there,

I'm trying to extend the oxconfig class via an Oxid Module. Things work fine, except when adding static methods.

What I'm trying to achieve with this module is basically having the reverse of the checkSpecialChars & checkParamSpecialChars methods.

Am I doing something wrong, or this is not achievable via the Oxid extend?

Thanks in advance!

Extracts from the relevant code:

metadata.php

PHP Code:
        'extend' => array(
                
'oxconfig' => 'my_module/my_class_oxconfig',
        ), 
my_class_oxconfig.php

PHP Code:
class my_class_oxconfig extends my_class_oxconfig_parent{
    
// calls to this method fail
    
public static function checkSpecialChars_decode$sValue$aRaw null )
    {
        return 
oxRegistry::getConfig()->checkParamSpecialChars_decode$sValue$aRaw );
    }
    
// calls to this method work as expected
    
public function checkParamSpecialChars_decode$sValue$aRaw null )
    {
        return 
'decoded value';
    }

my_controller.php

PHP Code:
$sMessage oxConfig::getParameter'c_message' );
// works fine
$sMessage oxRegistry::getConfig()->checkParamSpecialChars_decode$sMessage );
// fails with PHP Fatal error:
// Call to undefined method oxConfig::checkSpecialChars_decode() in my_controller.php
$sMessage oxConfig::checkSpecialChars_decode$sMessage ); 

Last edited by dev_ht; 04-04-2017 at 03:29 PM.
Reply With Quote
#Top   #2  
Old 04-14-2017, 12:05 PM
leofonic's Avatar
leofonic leofonic is offline
Moderator
Join Date: Oct 2009
Posts: 3,796
leofonic is on a distinguished road
Default AW: Extending oxconfig with static methods

The extension via Module is done on runtime when "oxnew" is called and an instance is created.
If you call oxconfig statically, you just call oxconfig. Oxconfig instance is a singleton, why do you need static methods?
__________________
Frank

www.zunderweb.de - Zunderweb IT Beratung - Templates und Module für Oxid eShop
Theme "EXP TWO" für 4.9.x - 2-spaltiges OXID 4.9 Theme mit 8 Farbschemata
Ajax Multifilter XL - Turbo für den Attributfilter
Reply With Quote
Reply

Bookmarks

Tags
extending, methods, oxconfig, static

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Nicht Sichtbar
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add static pages in oxid (and manage them)? Anpan Newbies 4 06-20-2014 12:45 PM
change oxconfig and oxconfig display - OXVARVALUE to anything other than BLOB soup Feature requests 6 04-03-2014 12:23 PM
extending oxconfig rdx Developers 2 08-28-2012 10:53 AM
Payment Methods - Fields & Deleting Payment methods karlis1989 General 5 03-05-2012 12:43 PM
Large Static Images euroblaze Administration 13 11-14-2010 08:28 PM

All times are GMT +1. The time now is 12:37 PM.