Code Duplication    Length = 11-20 lines in 2 locations

classes/PodsUI.php 2 locations

@@ 1562-1572 (lines=11) @@
1559
        if ( isset( $this->fields[ $this->action ] ) )
1560
            $fields = $this->fields[ $this->action ];
1561
1562
        if ( is_object( $this->pod ) ) {
1563
            $object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1564
1565
            if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], array( 'post_type', 'taxonomy', 'media', 'user', 'comment' ) ) )
1566
                $object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1567
1568
            if ( empty( $fields ) ) {
1569
                // Add core object fields if $fields is empty
1570
                $fields = array_merge( $object_fields, $this->pod->fields );
1571
            }
1572
        }
1573
1574
        $form_fields = $fields; // Temporary
1575
@@ 1665-1684 (lines=20) @@
1662
			$fields = $this->fields[ $this->action ];
1663
		}
1664
1665
		if ( is_object( $this->pod ) ) {
1666
			$object_fields = (array) pods_var_raw( 'object_fields', $this->pod->pod_data, array(), null, true );
1667
1668
			$object_field_objects = array(
1669
				'post_type',
1670
				'taxonomy',
1671
				'media',
1672
				'user',
1673
				'comment'
1674
			);
1675
1676
			if ( empty( $object_fields ) && in_array( $this->pod->pod_data[ 'type' ], $object_field_objects ) ) {
1677
				$object_fields = $this->pod->api->get_wp_object_fields( $this->pod->pod_data[ 'type' ], $this->pod->pod_data );
1678
			}
1679
1680
			if ( empty( $fields ) ) {
1681
				// Add core object fields if $fields is empty
1682
				$fields = array_merge( $object_fields, $this->pod->fields );
1683
			}
1684
		}
1685
1686
		$view_fields = $fields; // Temporary
1687