private function publishContent( $field, $value )
    {
        $repository = $this->getRepository();
        $languageCode = self::DEFAULT_LANGUAGE;

        $content = $repository->sudo(
            function() use( $repository, $languageCode, $field, $value )
            {
                $contentService = $repository->getcontentService();
                $locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( '2' );
                $contentType = $this->fieldConstructionObject[ 'contentType' ];
                $contentCreateStruct = $contentService->newContentCreateStruct( $contentType, $languageCode );
                if ( $field != null && $value != null )
                {
                    $value = ( $value == 'empty'  ) ? null : $value;
                    $value = is_numeric( $value ) ? $value + 0 : $value;
                    $contentCreateStruct->setField( $field, $value );
                }
                $draft = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
                $content = $contentService->publishVersion( $draft->versionInfo );

                return $content;
            }
        );
        $this->fieldConstructionObject[ 'content' ] = $content;
        $this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_PUBLISHED;
    }
private function publishContent( $field, $value )
    {
        $repository = $this->getRepository();
        $languageCode = self::DEFAULT_LANGUAGE;

        $content = $repository->sudo(
            function() use( $repository, $languageCode, $field, $value )
            {
                $contentService = $repository->getcontentService();
                $locationCreateStruct = $repository->getLocationService()->newLocationCreateStruct( '2' );
                $contentType = $this->fieldConstructionObject[ 'contentType' ];
                $contentCreateStruct = $contentService->newContentCreateStruct( $contentType, $languageCode );
                if ( $field != null && $value != null )
                {
                    $value = ( $value == 'empty'  ) ? null : $value;
                    $value = is_numeric( $value ) ? $value + 0 : $value;
                    $contentCreateStruct->setField( $field, $value );
                }
                $draft = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
                $content = $contentService->publishVersion( $draft->versionInfo );

                return $content;
            }
        );
        $this->fieldConstructionObject[ 'content' ] = $content;
        $this->fieldConstructionObject[ 'objectState' ] = self::CONTENT_PUBLISHED;
    }
private function publishContent ( $ field , $ value ) { $ repository = $ this -> getRepository ( ) ; $ languageCode = self :: DEFAULT_LANGUAGE ; $ content = $ repository -> sudo ( function ( ) use ( $ repository , $ languageCode , $ field , $ value ) { $ contentService = $ repository -> getcontentService ( ) ; $ locationCreateStruct = $ repository -> getLocationService ( ) -> newLocationCreateStruct ( '2' ) ; $ contentType = $ this -> fieldConstructionObject [ 'contentType' ] ; $ contentCreateStruct = $ contentService -> newContentCreateStruct ( $ contentType , $ languageCode ) ; if ( $ field != null && $ value != null ) { $ value = ( $ value == 'empty' ) ? null : $ value ; $ value = is_numeric ( $ value ) ? $ value + 0 : $ value ; $ contentCreateStruct -> setField ( $ field , $ value ) ; } $ draft = $ contentService -> createContent ( $ contentCreateStruct , array ( $ locationCreateStruct ) ) ; $ content = $ contentService -> publishVersion ( $ draft -> versionInfo ) ; return $ content ; } ) ; $ this -> fieldConstructionObject [ 'content' ] = $ content ; $ this -> fieldConstructionObject [ 'objectState' ] = self :: CONTENT_PUBLISHED ; }
Publishes the content

@param string The field name
@param mixed The field value
Publishes the content