Code Duplication    Length = 11-20 lines in 2 locations

classes/PodsUI.php 2 locations

@@ 1576-1586 (lines=11) @@
1573
        if ( isset( $this->fields[ $this->action ] ) )
1574
            $fields = $this->fields[ $this->action ];
1575
1576
        if ( is_object( $this->pod ) ) {
1577
            $object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1578
1579
            if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], array( 'post_type', 'taxonomy', 'media', 'user', 'comment' ) ) )
1580
                $object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1581
1582
            if ( empty( $fields ) ) {
1583
                // Add core object fields if $fields is empty
1584
                $fields = array_merge( $object_fields, $this->pod->fields );
1585
            }
1586
        }
1587
1588
        $form_fields = $fields; // Temporary
1589
@@ 1679-1698 (lines=20) @@
1676
			$fields = $this->fields[ $this->action ];
1677
		}
1678
1679
		if ( is_object( $this->pod ) ) {
1680
			$object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1681
1682
			$object_field_objects = array(
1683
				'post_type',
1684
				'taxonomy',
1685
				'media',
1686
				'user',
1687
				'comment'
1688
			);
1689
1690
			if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], $object_field_objects ) ) {
1691
				$object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1692
			}
1693
1694
			if ( empty( $fields ) ) {
1695
				// Add core object fields if $fields is empty
1696
				$fields = array_merge( $object_fields, $this->pod->fields );
1697
			}
1698
		}
1699
1700
		$view_fields = $fields; // Temporary
1701