Merge pull request #2288 from eileenmcnaughton/CRM-14043
[civicrm-core.git] / api / v3 / examples / ProfileGetFields.php
index c4ab716249ae2119c3f1fcbd466215d0ba87c4f6..eff419870a5921a5c50987018226e7a5d9ef5864 100644 (file)
@@ -6,7 +6,7 @@
 function profile_getfields_example(){
 $params = array(
   'action' => 'submit',
-  'profile_id' => 25,
+  'profile_id' => 27,
 );
 
 try{
@@ -34,9 +34,13 @@ function profile_getfields_expectedresult(){
   'count' => 9,
   'values' => array(
       'first_name' => array(
+          'api.required' => '1',
+          'title' => 'First Name',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'contact',
           'name' => 'first_name',
           'type' => 2,
-          'title' => 'First Name',
           'maxlength' => 64,
           'size' => 30,
           'import' => true,
@@ -44,11 +48,16 @@ function profile_getfields_expectedresult(){
           'headerPattern' => '/^first|(f(irst\s)?name)$/i',
           'dataPattern' => '/^\w+$/',
           'export' => true,
+          'api.aliases' => array(),
         ),
       'last_name' => array(
+          'api.required' => '1',
+          'title' => 'Last Name',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'contact',
           'name' => 'last_name',
           'type' => 2,
-          'title' => 'Last Name',
           'maxlength' => 64,
           'size' => 30,
           'import' => true,
@@ -56,12 +65,20 @@ function profile_getfields_expectedresult(){
           'headerPattern' => '/^last|(l(ast\s)?name)$/i',
           'dataPattern' => '/^\w+(\s\w+)?+$/',
           'export' => true,
+          'api.aliases' => array(),
         ),
-      'email' => array(
+      'email-primary' => array(
+          'api.required' => 1,
+          'title' => 'Email',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'email',
+          'api.aliases' => array(
+              '0' => 'email-Primary',
+            ),
           'name' => 'email',
           'type' => 2,
-          'title' => 'Email',
-          'maxlength' => 64,
+          'maxlength' => 254,
           'size' => 20,
           'import' => true,
           'where' => 'civicrm_email.email',
@@ -69,12 +86,15 @@ function profile_getfields_expectedresult(){
           'dataPattern' => '/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/',
           'export' => true,
           'rule' => 'email',
-          'api.required' => 1,
         ),
       'phone-1-1' => array(
+          'api.required' => 1,
+          'title' => 'Phone',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'phone',
           'name' => 'phone',
           'type' => 2,
-          'title' => 'Phone',
           'maxlength' => 32,
           'size' => 20,
           'import' => true,
@@ -82,12 +102,16 @@ function profile_getfields_expectedresult(){
           'headerPattern' => '/phone/i',
           'dataPattern' => '/^[\d\(\)\-\.\s]+$/',
           'export' => true,
-          'api.required' => 1,
+          'api.aliases' => array(),
         ),
       'country-1' => array(
+          'api.required' => '1',
+          'title' => 'Country',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'address',
           'name' => 'country_id',
           'type' => 1,
-          'title' => 'Country',
           'FKClassName' => 'CRM_Core_DAO_Country',
           'pseudoconstant' => array(
               'table' => 'civicrm_country',
@@ -95,22 +119,32 @@ function profile_getfields_expectedresult(){
               'labelColumn' => 'name',
               'nameColumn' => 'iso_code',
             ),
+          'api.aliases' => array(),
         ),
       'state_province-1' => array(
+          'api.required' => '1',
+          'title' => 'State',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'address',
           'name' => 'state_province_id',
           'type' => 1,
-          'title' => 'State',
           'FKClassName' => 'CRM_Core_DAO_StateProvince',
           'pseudoconstant' => array(
               'table' => 'civicrm_state_province',
               'keyColumn' => 'id',
               'labelColumn' => 'name',
             ),
+          'api.aliases' => array(),
         ),
       'postal_code-1' => array(
+          'api.required' => 0,
+          'title' => 'Postal Code',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'address',
           'name' => 'postal_code',
           'type' => 2,
-          'title' => 'Postal Code',
           'maxlength' => 12,
           'size' => 12,
           'import' => true,
@@ -118,8 +152,14 @@ function profile_getfields_expectedresult(){
           'headerPattern' => '/postal|zip/i',
           'dataPattern' => '/\d?\d{4}(-\d{4})?/',
           'export' => true,
+          'api.aliases' => array(),
         ),
       'custom_1' => array(
+          'api.required' => '1',
+          'title' => 'first_name',
+          'help_pre' => '',
+          'help_post' => '',
+          'entity' => 'contact',
           'label' => '_addCustomFieldToProfile',
           'groupTitle' => '_addCustomFie',
           'data_type' => 'String',
@@ -138,6 +178,8 @@ function profile_getfields_expectedresult(){
           'date_format' => '',
           'time_format' => '',
           'name' => 'custom_1',
+          'type' => 2,
+          'api.aliases' => array(),
         ),
       'profile_id' => array(
           'api.required' => true,