Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date format mapper - redo #7041

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions classes/Pods.php
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ public function field( $name, $single = null, $raw = false ) {
$is_tableless_field = in_array( $field_type, $tableless_field_types, true );
$is_repeatable_field = $field_data instanceof Field && $field_data->is_repeatable();
$is_pick_field = 'pick' === $field_type;
$is_mapped = false;

// Handle output specific handling.
if ( $is_pick_field ) {
Expand Down Expand Up @@ -925,11 +926,11 @@ public function field( $name, $single = null, $raw = false ) {

$value = $map_field_values->map_value( $first_field, $traverse_fields, $is_field_set ? $field_data : null, $this, $params );

$object_field_found = null !== $value;
$is_mapped = null !== $value;
}

// Continue regular field parsing.
if ( false === $object_field_found ) {
if ( false === $object_field_found && false === $is_mapped ) {
$params->traverse = array( $params->name );

if ( false !== strpos( $params->name, '.' ) ) {
Expand Down Expand Up @@ -1696,7 +1697,7 @@ public function field( $name, $single = null, $raw = false ) {
$value = array_merge( ...$value );
}

if ( ! empty( $field_data ) && ( $params->display || ! $params->raw ) && ! $params->in_form && ! $params->raw_display ) {
if ( ! $is_mapped && ! empty( $field_data ) && ( $params->display || ! $params->raw ) && ! $params->in_form && ! $params->raw_display ) {
sc0ttkclark marked this conversation as resolved.
Show resolved Hide resolved
if ( $params->display || ( ( $params->get_meta || $params->deprecated ) && ! in_array( $field_data['type'], $tableless_field_types, true ) ) ) {
$post_temp = false;
$old_post = null;
Expand Down
86 changes: 86 additions & 0 deletions src/Pods/Data/Map_Field_Values.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 156 additions & 0 deletions tests/codeception/wpunit/Pods/MappingTest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.