Jump to content

add method to FilenameArray via hook does not work


bernhard
 Share

Recommended Posts

hi!

i try to add a custom method to FilenameArray class to check if a file exists and remove it from array if not...

    public function init() {
        $this->addHook('FilenameArray::cleanup', $this, 'cleanupFileArray');
    }

    /**
     * remove non existant files from file array
     */
    public function cleanupFileArray($event) {
        // do some stuff
    }

but i always get the error

Fatal Error
Call to undefined method ProcessWire\FilenameArray::cleanup()

it works when i use Page::cleanup and Pages::cleanup and also when i add the method directly into the core file... but thats no option. what am i doing wrong?

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...