Code Duplication    Length = 11-20 lines in 2 locations

classes/PodsUI.php 2 locations

@@ 1582-1592 (lines=11) @@
1579
        if ( isset( $this->fields[ $this->action ] ) )
1580
            $fields = $this->fields[ $this->action ];
1581
1582
        if ( is_object( $this->pod ) ) {
1583
            $object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1584
1585
            if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], array( 'post_type', 'taxonomy', 'media', 'user', 'comment' ) ) )
1586
                $object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1587
1588
            if ( empty( $fields ) ) {
1589
                // Add core object fields if $fields is empty
1590
                $fields = array_merge( $object_fields, $this->pod->fields );
1591
            }
1592
        }
1593
1594
        $form_fields = $fields; // Temporary
1595
@@ 1685-1704 (lines=20) @@
1682
			$fields = $this->fields[ $this->action ];
1683
		}
1684
1685
		if ( is_object( $this->pod ) ) {
1686
			$object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1687
1688
			$object_field_objects = array(
1689
				'post_type',
1690
				'taxonomy',
1691
				'media',
1692
				'user',
1693
				'comment'
1694
			);
1695
1696
			if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], $object_field_objects ) ) {
1697
				$object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1698
			}
1699
1700
			if ( empty( $fields ) ) {
1701
				// Add core object fields if $fields is empty
1702
				$fields = array_merge( $object_fields, $this->pod->fields );
1703
			}
1704
		}
1705
1706
		$view_fields = $fields; // Temporary
1707