Created
May 19, 2013 12:12
-
-
Save iainurquhart/5607482 to your computer and use it in GitHub Desktop.
Matrix and Channel Entries API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// example incoming data | |
$operator['online_profiles'][] = array( | |
'PROFILE_TYPE' => 'facebook', | |
'PROFILE_DATA' => 'http://facebook.com/foo' | |
); | |
// prep for matrix API | |
// field_id and col_id hardcoded | |
if(count($operator['online_profiles'])) | |
{ | |
$i = 0; | |
foreach($operator['online_profiles'] as $profile) | |
{ | |
$data["field_id_121"]['row_order'][] = "row_new_$i"; | |
$data["field_id_121"]["row_new_$i"]["col_id_48"] = $profile['PROFILE_DATA']; | |
$data["field_id_121"]["row_new_$i"]["col_id_49"] = $profile['PROFILE_TYPE']; | |
$i++; | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment