Cannot add new page in Concrete 5.4.2
Permalink 1 user found helpful
It is simple like that and I'm afraid this problem is happening to everybody and almost no one noticed it even though this is CRITICAL.
I'm getting this error:
So I looked and this file is calling $this->field() in several places and it doesn't work.
This method does not exist in the controller!
PLEASE HELP! This thing is not letting me add new pages in Concrete5. My client is complaining.
I'm getting this error:
Fatal error: Call to undefined method AttributeTypeView::field() in<irrelevant path>/updates/concrete5.4.2/concrete/models/attribute/types/select/form.php on line 85
So I looked and this file is calling $this->field() in several places and it doesn't work.
newRow.innerHTML='<input name="<?php echo $this->field('atSelectNewOption')?>[]" type="hidden" value="'+value+'" /> ';
This method does not exist in the controller!
PLEASE HELP! This thing is not letting me add new pages in Concrete5. My client is complaining.
The file that you should edit is:
concrete/models/attribute/types/select/form.php
Of course you can do this by not changing the core files.
So just create a new file under:
models/attribute/types/select (you will probably need to create these directories).
... called form.php
concrete/models/attribute/types/select/form.php
Of course you can do this by not changing the core files.
So just create a new file under:
models/attribute/types/select (you will probably need to create these directories).
... called form.php
Hmm. Do you have a forked copy of view.php in libraries? Because yes, field() as a function doesn't exist in libraries/attribute/view.php, but it does exist in libraries/view.php, and it's just called $this->controller->field() – which should make it work just fine.
Just to reaffirm, I was having exactly the same problem with adding pages. I've also overriden view.php using the 5.4.1.1 version so like you said that's the reason behind the problem.
Noticed that in the new version 5.4.2 you've added to view.php
So yea, updating view.php (preferred) or hacking models/attribute/types/select/form.php works =)
Thanks for the clarification!
Noticed that in the new version 5.4.2 you've added to view.php
public function field($fieldName) { return $this->controller->field($fieldName); }
So yea, updating view.php (preferred) or hacking models/attribute/types/select/form.php works =)
Thanks for the clarification!
I've noticed that the class that it should refer is the SelectAttributeTypeController which extends AttributeTypeController.
AttributeTypeController has the field() method.
But, it seems that the context of $this is actually AttributeTypeView and not AttributeTypeController.
You can reach the field() method by calling:
So I've searched and replaced all occurrences of $this->field to $this->controller->field and it solved my problem.
Hope it helps.