How to add PARAMS to Service Calls?
I'm trying to add a parameter for the entity_info service call to show specific fields of the persons_data table. Can someone help me with the syntax to write after 'params' => array() of the service call?
-
-
·
LeonidS
- ·
Hello SehaSky !
See the example form Developer app for Persons->View page->My photos block
array (
'module' => 'bx_photos',
'method' => 'browse_author',
'params' =>
array (
0 => '{profile_id}',
1 =>
array (
'per_page' => 'bx_photos_per_page_profile',
'empty_message' => false,
),
),
The bold lines show the array f arguments, passed to service.
-
·
LeonidS
-
- · Scholar
- ·
Thanks a lot LeonidS. Actually, the entity_info service call does not take $aParams argument. Therefore, I was asking about the query array, that is normally specified as params[]=123¶ms[]=abc to get a partial response from the API. I want to use 'field' parameter to receive a partial-response with only 2 fields from the persons table ('fullname' and 'birthday' fields only) instead of the whole fields in the table. Any idea how to write the syntax in the service call?
-
-
·
LeonidS
-
·
In reply to Scholar
S
- ·
The method serviceEntityInfo has only 2 possible arguments, content id and display name:
public function serviceEntityInfo ($iContentId = 0, $sDisplay = false)
So call of it will have the following view (example with Persons Info block):
$sCode = BxDolService::call('bx_persons', 'entity_info', array($iContentId, 'bx_person_view'));
So the bold line means the array of the given arguments. Your request (show 2 fields instead of all) means that you need to have the new display (if you don't want the current Info set studio/builder_forms.php?page=fields&module=bx_persons&object=bx_person&display=bx_person_view) with this 2 fields.
How to create Form Displays, add records to sys_form_displays table:
- display_name - name of the Form Display, in the format: form object name, underscore, internal identifier or nothing; for example: bx_group_add - for displaying group adding form, bx_group_edit - for displaying group editing form
- module - module name this display belongs to, it must be associated with name field in sys_modules table.
- object - form object name from sys_objects_form table this Form Display belongs to.
- title - Form Display title to display in studio forms builder.
- view_mode - display form as read-only.
-
·
LeonidS
-