Jump to content

[Solved] _extending _uikit.php functionality in extra file HOW to??


danielsl
 Share

Recommended Posts

i decided to extend _uikit.php  functionality with extra functions in separate file in case in future updates,

in _init.php i included my _uikit_override.php call

in _uikit_override.php i have

include_once('./_uikit.php'); 

function ukEventPost(Page $page, $options = array()) {
....

its still copy of ukBlogPosts

...

but after that i have strange error

 


TypeError

Argument 1 passed to ProcessWire\ukEventPost() must be an instance of ProcessWire\Page, instance of ProcessWire\PageArray given, called in C:\WTServer\WWW\pw32\site\templates\home.php on line 34 search

Source file

File: ...\WWW\pw32\site\templates\_uikit_override.php:84

74:     *  - `divider` (bool): Specify true to show a divider between root level items (default=auto). 
75:     *  - `attr` (string): A string of additional tag attributes to add to the `<ul>` (default=''). 
76:     *  - `fields` (array): Any additional fields you want to display for each item. 
77:     * @return string
78:     *
79:     */
80:    
81:    #include(_uikit.php);
82:    include_once('./_uikit.php'); 
83:    
84:    function ukEventPost(Page $page, $options = array()) {
85:        
86:        $defaults = array(
87:            'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect)
88:            'metaIcon' => 'info',

any ideas how to properly include php files and call functions??

Link to comment
Share on other sites

Reading the error, it says you have a type error. It expect an Object of type Page, but it got passed an object of type PageArray. So, it has nothing to do with your sort of include, I believe.

So, somewhere in your (template ??) code you have called ukEventPost() and passed it a PageArray instead of a Page. Please refer to the other error lines until you found which file / line raised it, and change this, that it passes a single Page, and not a PageArray. :)

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...