public function extendedRequiredFieldsEmbargoExpiry($data)
    {
        $response = array(
            'fieldName'  => 'DesiredUnPublishDate[date]',
            'fieldField' => null,
            'fieldMsg'   => null,
            'fieldValid' => true
        );

        if (isset($data['DesiredPublishDate'], $data['DesiredUnPublishDate'])) {
            $publish = DBDatetime::create()->setValue($data['DesiredPublishDate'])->getTimestamp();
            $unpublish = DBDatetime::create()->setValue($data['DesiredUnPublishDate'])->getTimestamp();

            // the times are the same
            if ($publish && $unpublish && $publish == $unpublish) {
                $response = array_merge($response, array(
                    'fieldMsg'   => _t(
                        'WorkflowEmbargoExpiryExtension.INVALIDSAMEEMBARGOEXPIRY',
                        'The publish date and unpublish date cannot be the same.'
                    ),
                    'fieldValid' => false
                ));
            } elseif ($publish && $unpublish && $publish > $unpublish) {
                $response = array_merge($response, array(
                    'fieldMsg'   => _t(
                        'WorkflowEmbargoExpiryExtension.INVALIDEXPIRY',
                        'The unpublish date cannot be before the publish date.'
                    ),
                    'fieldValid' => false
                ));
            }
        }

        return $response;
    }
public function extendedRequiredFieldsEmbargoExpiry($data)
    {
        $response = array(
            'fieldName'  => 'DesiredUnPublishDate[date]',
            'fieldField' => null,
            'fieldMsg'   => null,
            'fieldValid' => true
        );

        if (isset($data['DesiredPublishDate'], $data['DesiredUnPublishDate'])) {
            $publish = DBDatetime::create()->setValue($data['DesiredPublishDate'])->getTimestamp();
            $unpublish = DBDatetime::create()->setValue($data['DesiredUnPublishDate'])->getTimestamp();

            // the times are the same
            if ($publish && $unpublish && $publish == $unpublish) {
                $response = array_merge($response, array(
                    'fieldMsg'   => _t(
                        'WorkflowEmbargoExpiryExtension.INVALIDSAMEEMBARGOEXPIRY',
                        'The publish date and unpublish date cannot be the same.'
                    ),
                    'fieldValid' => false
                ));
            } elseif ($publish && $unpublish && $publish > $unpublish) {
                $response = array_merge($response, array(
                    'fieldMsg'   => _t(
                        'WorkflowEmbargoExpiryExtension.INVALIDEXPIRY',
                        'The unpublish date cannot be before the publish date.'
                    ),
                    'fieldValid' => false
                ));
            }
        }

        return $response;
    }
public function extendedRequiredFieldsEmbargoExpiry ( $ data ) { $ response = array ( 'fieldName' => 'DesiredUnPublishDate[date]' , 'fieldField' => null , 'fieldMsg' => null , 'fieldValid' => true ) ; if ( isset ( $ data [ 'DesiredPublishDate' ] , $ data [ 'DesiredUnPublishDate' ] ) ) { $ publish = DBDatetime :: create ( ) -> setValue ( $ data [ 'DesiredPublishDate' ] ) -> getTimestamp ( ) ; $ unpublish = DBDatetime :: create ( ) -> setValue ( $ data [ 'DesiredUnPublishDate' ] ) -> getTimestamp ( ) ; // the times are the same if ( $ publish && $ unpublish && $ publish == $ unpublish ) { $ response = array_merge ( $ response , array ( 'fieldMsg' => _t ( 'WorkflowEmbargoExpiryExtension.INVALIDSAMEEMBARGOEXPIRY' , 'The publish date and unpublish date cannot be the same.' ) , 'fieldValid' => false ) ) ; } elseif ( $ publish && $ unpublish && $ publish > $ unpublish ) { $ response = array_merge ( $ response , array ( 'fieldMsg' => _t ( 'WorkflowEmbargoExpiryExtension.INVALIDEXPIRY' , 'The unpublish date cannot be before the publish date.' ) , 'fieldValid' => false ) ) ; } } return $ response ; }
This is called in the AWRequiredFields class, this validates whether an Embargo and Expiry are not equal and that
Embargo is before Expiry, returning the appropriate message when it fails.

@param $data
@return array
This is called in the AWRequiredFields class this validates whether an Embargo and Expiry are not equal and that Embargo is before Expiry returning the appropriate message when it fails .