I have a link field called lien
. When I get it from the API through the Item
it belongs to, I receive the following array:
[lien] => Array(
[0] => Array(
[embed] => 49935230
[file] => 129256002
)
)
I have no problem with the file.
How do you get the URL value?
The Embeds
documentation: https://developers.podio.com/doc/embeds
A similar issue exists when getting the value of a category field through the Item
object. It's an array of the selected option_id
, it doesn't hold the option_text
. The workaround is to get the corresponding App
object and search for the option_text
using the provided option_id
.
The field's values are returned as a collection of embed objects. You can see documentation at: http://podio.github.io/podio-php/fields/#linkembed-field
E.g.:
$item = PodioItem::get_basic(123);
$field_id = 'embed';
$collection = $item->fields[$field_id]->values;
foreach ($collection as $embed) {
print "Embed id: ".$embed->embed_id;
print "Embed URL: ".$embed->original_url;
}