Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions fields/class-cmb-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,24 @@ public function display() {
$this->description();

$i = 0;
if ( isset( $this->args['type'] ) && 'gmap' == $this->args['type'] ) {
$values = array( $values );

// If the map field is not repeatable then we need to wrap it within an
// array to remove difference in data structure between a repeater field and normal
if ( isset( $this->args['type'] ) && 'gmap' === $this->args['type'] ) {
if ( $this->args['repeatable'] === false && ! isset( $this->parent ) ) {
$values = array( $values );
}

// If its within a group then we need to unwrap it from the group,
if ( $this->args['repeatable'] === false && isset( $this->parent ) ) {
$values = $values[0];

// Transitions code for data formats see:
// https://github.com/humanmade/Custom-Meta-Boxes/issues/422
if ( count( $values ) !== 1 ) {
$values = array( $values );
}
}
}

foreach ( $values as $key => $value ) {
Expand Down