Closed szepeviktor closed 8 years ago
Maybe wp_get_attachment_url( $aField['attributes']['id'] );
?
This works for me
private function _getTheSetImageURL(array $aField, $iCountAttributes) {
$_sCaptureAttribute = $this->getAOrB($iCountAttributes, 'id', '');
return $_sCaptureAttribute ? wp_get_attachment_url( $this->getElement($aField, array('attributes', 'value', $_sCaptureAttribute), '') ) : '';
}
I hardly remember it but the saved value type becomes different (string vs array) when the attributes_to_store
argument is set. When the user sets an attribute to save, the field value becomes an array and the image url gets stored in the url
element of the array. Otherwise, it will store the url as a string and don't create an array so you won't see the url
element.
Let me know if the attributes_to_store
argument does not let you store expected values.
Closing the topic as the problem cannot be confirmed.
OK.
Please take a look at my class for ultra simple options page maker: https://github.com/szepeviktor/wordpress-plugin-construction/blob/master/theme-options-page/one-theme-options-page-minimal-example.php
Thanks.
https://github.com/michaeluno/admin-page-framework/blob/ce9d08d48ac4f6aacd476e316b8bf5e7e7cd7408/library/apf/factory/_common/form/field_type/AdminPageFramework_FieldType_media.php#L414-L416
What could we do?