Accessing custom field values added to /blueprints/pages/
This is an open discussion with 7 replies, filed under Extensions.
Search
Isnt it $fields[settings][yourfield] ?
Check out my blueprintspagestextarea repo.. not complete.. but I was appending a text area to the blueprints/pages.
Edit.. my bad.. that is for preferences...
I believe the first part of the code needs to be a valid field type... then your field name in brackets.
Thanks @moonoo2. I looked at your extension, and it turns out you're using some weird array thing: $_POST
... [headsmack] I'll do the same. :-)
I assumed that I should be accessing my custom field values via $context['fields']
. The API says the following:
$fields array
An associative array of data that was just saved for this page
So "the data just saved for this page" only includes Symphony's own fields?
Every field name will try and match to a column name in a database table, so if you have extra fields for an extension, you'll need to pull them out of the POST fields array, deal with them separately, then let the remaining POST fields array go through to the database
Edit: ah, I see.
Is there anything wrong with setting my own name and leaving the fields
array alone, and accessing via $_POST
directly?
That's what I'm trying to do as well David.
As John mentioned, the fields array is mapped to the table fields.
I'm attempting to override the entry into a specific field before it gets to the table field. So $_POST['myfield'];
is what I'm trying to use.
My custom page values are going into a separate table (I was advised to keep this separation and not mess with the core pages tables). Using $_POST['myextension']['setting']
is working fine.
Thanks for the pointers and explanations. Kind of fun, this extension development business. :-)
It is isn't it :-) A totally new way to enjoy Symphony :P
Create an account or sign in to comment.
I'm building an extension and have added some fields to the Page edit page using the
AppendPageContent
delegate.If I name these fields
extensionname[setting]
, the values don't seem to be present in the$fields
array returned from thePagePostEdit
delegate.If I name these fields
fields[extensionname_setting]
, I getSymphony Fatal Database Error: Unknown column 'extensionname_setting' in 'field list'
.How can I grab the values?