Field inherit from parent in extended class

It’s probably PHP related and also probably very simple for pro oop users.

class myfieldField extends TextareaField {
	public function content() {
		$buffer = $this->content();
		return $buffer . 'extra';

I extend the textarea field. I don’t want to overwrite the content function, I just want to something extra to it.

The reason for it is that I want to touch it as little as possible. I could solve it with js, but it feels wrong.

Is it possible to load $this->content() inside the content method?

I’m very thankful for every solution that works (except for js). :slight_smile:

Fatal error: Maximum function nesting level of ‘100’ reached, aborting!

I solved it myself:

It should be…

$buffer = parent::content();

You’d have to use the parent keyword:

1 Like

Yes! :smiley:

I just remembered another post where it’s used: