Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to redeclare a function in php
Tiggr
✭
Hi!
I'm new to php ... but:
I try to build my own application, using the framework of vanilla to get user-authentification, delegates, themes, styles and all the other good things into my application.
No I want to avoid mixing of my own files and the vanilla files, and I want to avoid hacking vanilla files. Works better then expectet, but I have one problem: Framwork.Functions.php defines many functions. Most of theme can stay, but I would like to change some of them, especially ThemeFilesPath. But I can't redeclare it, and don't want to change Framwork.Functions.php - what to do!
Bye
Tiggr
I'm new to php ... but:
I try to build my own application, using the framework of vanilla to get user-authentification, delegates, themes, styles and all the other good things into my application.
No I want to avoid mixing of my own files and the vanilla files, and I want to avoid hacking vanilla files. Works better then expectet, but I have one problem: Framwork.Functions.php defines many functions. Most of theme can stay, but I would like to change some of them, especially ThemeFilesPath. But I can't redeclare it, and don't want to change Framwork.Functions.php - what to do!
Bye
Tiggr
0
This discussion has been closed.
Comments
I would like to customize GetUrl, and a few others but haven't for that reason.
Maybe create an appg/functions.php file with declarations of all core function names?
$Func['ThemeFilesPath'] = 'ThemeFilesPath';
And then everywhere in the core the function is called like this:
$Func['ThemeFilesPath']();
If you want to ovverride the function, you copy it to get basic functionality and parameters and then add $Func['ThemeFilePath'] = 'MyVersionOfThemeFilePath'; to conf/functions.php.
What did you want to change about the ThemeFilePath function? I've been wanting to make some changes to it, too...
What about the idea, to put all the functions into a class? Then we could overwrite the class! But it would be a huge change to the core and many extensions... :-(
Bye
Tiggr
Is that the type of thing you are trying to do?
I don't like the idea of putting the functions into a class. method calls vs function calls are way slower in php.
What I try to do is a whole new application, using the vanilla/peoples framework. Somthing like Gossamer Threads Links.
So if you have a function like this
<?php function theme_item_list($items = array(), $title = NULL) { ?>
you can override it using this
<?php /** * Catch the theme_item_list function, and redirect through the template api */ function phptemplate_item_list($items = array(), $title = NULL) { // Pass to phptemplate, including translating the parameters to an associative array. // The element names are the names that the variables // will be assigned within your template. return _phptemplate_callback('item_list', array('items' => $items, 'title' => $title)); } ?>
you should check out Drupal Template api and see how it works
Here is the documentation of overriding Drupal theme functions