Jump to content

Modify field


Nico Knoll
 Share

Recommended Posts

You should be able to hook InputfieldPageName::render, but note that it will return markup (and should just be the <input /> tag). If you want to modify some attributes from it or something, then you'd want to hook in before(render). If you want to modify the returned markup you'd want to hook in after(render).

Link to comment
Share on other sites

I just replaced the "<p class="...">" with preg_replace. But now I've got the problem that I have to save an additional template file (permalinkFormat) but if I use "___executeSave" I can't use "$this->input->post" because it does a redirect...

Link to comment
Share on other sites

I just replaced the "<p class="...">" with preg_replace.

It may be better to come in with a 'before' hook and as the class attribute directly, rather than doing a preg_replace. But I don't know the full context here so can't say for certain.

but if I use "___executeSave" I can't use "$this->input->post" because it does a redirect...

Can you hook in before it? i.e.

$this->addHookBefore('ProcessPageEdit::executeSave', $this, 'myExecuteSave'); 
Link to comment
Share on other sites

Here are the 4 different kinds of hooks, in order of use. The method you use to hook them is in parenthesis.

1. After hooks – execute after the hooked method (addHook or addHookAfter). Can access/modify return value and arguments.

2. Before hooks – execute before the hooked method (addHookBefore). Can access/modify arguments.

3. Method hooks – adds a new method to a class, assuming it's not already there (addHook).

4. Property hooks – adds a new variable/property to a class, assuming it's not already there (addHookProperty). Rarely used so far.

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...