module/Customize/src/Grid/Customize/Model/Rpc.php
public function isSelectorAvailable( $selector,
                                         $fields = array(),
                                         $rootId = null )
    {
        if ( is_scalar( $fields ) )
        {
            $media = (string) $fields;
            $id    = null;
        }
        else
        {
            $fields = (object) $fields;
            $media  = empty( $fields->media )           ? ''    : $fields->media;
            $rootId = empty( $fields->rootParagraphId ) ? null  : (int) $fields->rootParagraphId;
            $id     = empty( $fields->id )              ? null  : (int) $fields->id;
        }

        if ( $this->getRuleMapper()
                  ->isSelectorExists( $selector, $media, $rootId, $id ) )
        {
            return static::SELECTOR_TAKEN;
        }

        $matches = array();

        if ( preg_match( '/#paragraph-(\\d+)/', $selector, $matches ) )
        {
            if ( ! $this->getParagraphMapper()
                        ->isParagraphIdExists( $matches[1] ) )
            {
                return static::SELECTOR_PARAGRAPH_NOT_EXISTS;
            }
        }

        return static::SUCCESS;
    }
public function isSelectorAvailable( $selector,
                                         $fields = array(),
                                         $rootId = null )
    {
        if ( is_scalar( $fields ) )
        {
            $media = (string) $fields;
            $id    = null;
        }
        else
        {
            $fields = (object) $fields;
            $media  = empty( $fields->media )           ? ''    : $fields->media;
            $rootId = empty( $fields->rootParagraphId ) ? null  : (int) $fields->rootParagraphId;
            $id     = empty( $fields->id )              ? null  : (int) $fields->id;
        }

        if ( $this->getRuleMapper()
                  ->isSelectorExists( $selector, $media, $rootId, $id ) )
        {
            return static::SELECTOR_TAKEN;
        }

        $matches = array();

        if ( preg_match( '/#paragraph-(\\d+)/', $selector, $matches ) )
        {
            if ( ! $this->getParagraphMapper()
                        ->isParagraphIdExists( $matches[1] ) )
            {
                return static::SELECTOR_PARAGRAPH_NOT_EXISTS;
            }
        }

        return static::SUCCESS;
    }
public function isSelectorAvailable ( $ selector , $ fields = array ( ) , $ rootId = null ) { if ( is_scalar ( $ fields ) ) { $ media = ( string ) $ fields ; $ id = null ; } else { $ fields = ( object ) $ fields ; $ media = empty ( $ fields -> media ) ? '' : $ fields -> media ; $ rootId = empty ( $ fields -> rootParagraphId ) ? null : ( int ) $ fields -> rootParagraphId ; $ id = empty ( $ fields -> id ) ? null : ( int ) $ fields -> id ; } if ( $ this -> getRuleMapper ( ) -> isSelectorExists ( $ selector , $ media , $ rootId , $ id ) ) { return static :: SELECTOR_TAKEN ; } $ matches = array ( ) ; if ( preg_match ( '/#paragraph-(\\d+)/' , $ selector , $ matches ) ) { if ( ! $ this -> getParagraphMapper ( ) -> isParagraphIdExists ( $ matches [ 1 ] ) ) { return static :: SELECTOR_PARAGRAPH_NOT_EXISTS ; } } return static :: SUCCESS ; }
Is selector available

@param   string $email
@param   array|object|string $fields [optional]
@param   int|null $rootId [optional]
@return  string
Is selector available