diff --git a/acf-sites-v4.php b/acf-sites-v4.php
index 3283440..9d01729 100644
--- a/acf-sites-v4.php
+++ b/acf-sites-v4.php
@@ -151,6 +151,27 @@ function create_options($field)
?>
+
+
+
+
+ |
+
+ 'radio',
+ 'name' => 'fields[' . $key . '][return_value]',
+ 'value' => $field['return_value'],
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'id' => __('ID'),
+ 'name' => __('Name'),
+ 'siteurl' => __('URL')
+ )
+ ));
+ ?>
+ |
+
blogname;
+ }
+ return $new_value;
+ }
+ }elseif($returnvalue == 'siteurl'){
+ $new_value = array();
+ if($value){
+ foreach($value as $site_id){
+ $new_value[] = get_blog_details($site_id)->siteurl;
+ }
+ return $new_value;
+ }
+ }
// Note: This function can be removed if not used
return $value;
diff --git a/acf-sites-v5.php b/acf-sites-v5.php
index 7a13014..e0af191 100755
--- a/acf-sites-v5.php
+++ b/acf-sites-v5.php
@@ -123,7 +123,7 @@ function render_field_settings( $field ) {
'layout' => 'horizontal',
'choices' => array(
'yes' => __('Yes'),
- 'no' => __('No'),
+ 'no' => __('No')
)
));
@@ -135,7 +135,20 @@ function render_field_settings( $field ) {
'layout' => 'horizontal',
'choices' => array(
'yes' => __('Yes'),
- 'no' => __('No'),
+ 'no' => __('No')
+ )
+ ));
+
+ acf_render_field_setting( $field, array(
+ 'label' => __('Return value','acf-sites'),
+ 'instructions' => __('','acf-sites'),
+ 'type' => 'radio',
+ 'name' => 'return_value',
+ 'layout' => 'horizontal',
+ 'choices' => array(
+ 'id' => __('ID'),
+ 'name' => __('Name'),
+ 'siteurl' => __('URL')
)
));
@@ -402,13 +415,33 @@ function field_group_admin_head() {
* @param $field (array) the field array holding all the field options
* @return $value
*/
- /*
function load_value( $value, $post_id, $field ) {
+ $returnvalue = $field['return_value'];
+ if($returnvalue == 'id'){
+ return $value;
+ }elseif($returnvalue == 'name'){
+ $new_value = array();
+ if($value){
+ foreach($value as $site_id){
+ $new_value[] = get_blog_details($site_id)->blogname;
+ }
+ return $new_value;
+ }
+ }elseif($returnvalue == 'siteurl'){
+ $new_value = array();
+ if($value){
+ foreach($value as $site_id){
+ $new_value[] = get_blog_details($site_id)->siteurl;
+ }
+ return $new_value;
+ }
+ }
+
return $value;
}
- */
+