Jump to content

Recommended Posts

Posted

Hi,

I try to modify the "InputfieldPageName".

I'm using the render hook, but it returns the whole form so I'm looking for a way to only modify this specific field. Does anone know a way?

Greets,

Nico

Posted

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

Posted

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

Posted
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'); 
Posted

It literally runs your code before that process - saving the page in your case.

Posted

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.

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
  • Recently Browsing   0 members

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