private function getPermissionArray()
    {
        $permissionArray = array(
            'can_add'           => false,
            'subtree_limit'     => $this->Attribute->contentClassAttribute()->attribute( eZTagsType::SUBTREE_LIMIT_FIELD ),
            'allowed_locations' => array(),
            'allowed_locations_tags' => false );

        $userLimitations = eZTagsTemplateFunctions::getSimplifiedUserAccess( 'tags', 'add' );

        if ( $userLimitations['accessWord'] == 'no' )
            return $permissionArray;

        $userLimitations = isset( $userLimitations['simplifiedLimitations']['Tag'] ) ? $userLimitations['simplifiedLimitations']['Tag'] : array();
        $limitTag = eZTagsObject::fetchWithMainTranslation( $permissionArray['subtree_limit'] );

        if ( empty( $userLimitations ) )
        {
            if ( $permissionArray['subtree_limit'] == 0 || $limitTag instanceof eZTagsObject )
            {
                $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );

                if ( $limitTag instanceof eZTagsObject )
                    $permissionArray['allowed_locations_tags'] = array( $limitTag );
            }
        }
        else if ( $permissionArray['subtree_limit'] == 0 )
        {
            $permissionArray['allowed_locations_tags'] = array();

            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                foreach ( $userLimitations as $limitation )
                {
                    $permissionArray['allowed_locations'][] = $limitation->attribute( 'id' );
                    $permissionArray['allowed_locations_tags'][] = $limitation;
                }
            }
        }
        else if ( $limitTag instanceof eZTagsObject )
        {
            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                $pathString = $limitTag->attribute( 'path_string' );
                foreach ( $userLimitations as $limitation )
                {
                    if ( strpos( $pathString, '/' . $limitation->attribute( 'id' ) . '/' ) !== false )
                    {
                        $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );
                        $permissionArray['allowed_locations_tags'] = array( $limitTag );
                        break;
                    }
                }
            }
        }

        if ( !empty( $permissionArray['allowed_locations'] ) )
            $permissionArray['can_add'] = true;

        return $permissionArray;
    }
private function getPermissionArray()
    {
        $permissionArray = array(
            'can_add'           => false,
            'subtree_limit'     => $this->Attribute->contentClassAttribute()->attribute( eZTagsType::SUBTREE_LIMIT_FIELD ),
            'allowed_locations' => array(),
            'allowed_locations_tags' => false );

        $userLimitations = eZTagsTemplateFunctions::getSimplifiedUserAccess( 'tags', 'add' );

        if ( $userLimitations['accessWord'] == 'no' )
            return $permissionArray;

        $userLimitations = isset( $userLimitations['simplifiedLimitations']['Tag'] ) ? $userLimitations['simplifiedLimitations']['Tag'] : array();
        $limitTag = eZTagsObject::fetchWithMainTranslation( $permissionArray['subtree_limit'] );

        if ( empty( $userLimitations ) )
        {
            if ( $permissionArray['subtree_limit'] == 0 || $limitTag instanceof eZTagsObject )
            {
                $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );

                if ( $limitTag instanceof eZTagsObject )
                    $permissionArray['allowed_locations_tags'] = array( $limitTag );
            }
        }
        else if ( $permissionArray['subtree_limit'] == 0 )
        {
            $permissionArray['allowed_locations_tags'] = array();

            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                foreach ( $userLimitations as $limitation )
                {
                    $permissionArray['allowed_locations'][] = $limitation->attribute( 'id' );
                    $permissionArray['allowed_locations_tags'][] = $limitation;
                }
            }
        }
        else if ( $limitTag instanceof eZTagsObject )
        {
            /** @var eZTagsObject[] $userLimitations */
            $userLimitations = eZTagsObject::fetchList( array( 'id' => array( $userLimitations ) ), null, null, true );
            if ( is_array( $userLimitations ) && !empty( $userLimitations ) )
            {
                $pathString = $limitTag->attribute( 'path_string' );
                foreach ( $userLimitations as $limitation )
                {
                    if ( strpos( $pathString, '/' . $limitation->attribute( 'id' ) . '/' ) !== false )
                    {
                        $permissionArray['allowed_locations'] = array( $permissionArray['subtree_limit'] );
                        $permissionArray['allowed_locations_tags'] = array( $limitTag );
                        break;
                    }
                }
            }
        }

        if ( !empty( $permissionArray['allowed_locations'] ) )
            $permissionArray['can_add'] = true;

        return $permissionArray;
    }
private function getPermissionArray ( ) { $ permissionArray = array ( 'can_add' => false , 'subtree_limit' => $ this -> Attribute -> contentClassAttribute ( ) -> attribute ( eZTagsType :: SUBTREE_LIMIT_FIELD ) , 'allowed_locations' => array ( ) , 'allowed_locations_tags' => false ) ; $ userLimitations = eZTagsTemplateFunctions :: getSimplifiedUserAccess ( 'tags' , 'add' ) ; if ( $ userLimitations [ 'accessWord' ] == 'no' ) return $ permissionArray ; $ userLimitations = isset ( $ userLimitations [ 'simplifiedLimitations' ] [ 'Tag' ] ) ? $ userLimitations [ 'simplifiedLimitations' ] [ 'Tag' ] : array ( ) ; $ limitTag = eZTagsObject :: fetchWithMainTranslation ( $ permissionArray [ 'subtree_limit' ] ) ; if ( empty ( $ userLimitations ) ) { if ( $ permissionArray [ 'subtree_limit' ] == 0 || $ limitTag instanceof eZTagsObject ) { $ permissionArray [ 'allowed_locations' ] = array ( $ permissionArray [ 'subtree_limit' ] ) ; if ( $ limitTag instanceof eZTagsObject ) $ permissionArray [ 'allowed_locations_tags' ] = array ( $ limitTag ) ; } } else if ( $ permissionArray [ 'subtree_limit' ] == 0 ) { $ permissionArray [ 'allowed_locations_tags' ] = array ( ) ; /** @var eZTagsObject[] $userLimitations */ $ userLimitations = eZTagsObject :: fetchList ( array ( 'id' => array ( $ userLimitations ) ) , null , null , true ) ; if ( is_array ( $ userLimitations ) && ! empty ( $ userLimitations ) ) { foreach ( $ userLimitations as $ limitation ) { $ permissionArray [ 'allowed_locations' ] [ ] = $ limitation -> attribute ( 'id' ) ; $ permissionArray [ 'allowed_locations_tags' ] [ ] = $ limitation ; } } } else if ( $ limitTag instanceof eZTagsObject ) { /** @var eZTagsObject[] $userLimitations */ $ userLimitations = eZTagsObject :: fetchList ( array ( 'id' => array ( $ userLimitations ) ) , null , null , true ) ; if ( is_array ( $ userLimitations ) && ! empty ( $ userLimitations ) ) { $ pathString = $ limitTag -> attribute ( 'path_string' ) ; foreach ( $ userLimitations as $ limitation ) { if ( strpos ( $ pathString , '/' . $ limitation -> attribute ( 'id' ) . '/' ) !== false ) { $ permissionArray [ 'allowed_locations' ] = array ( $ permissionArray [ 'subtree_limit' ] ) ; $ permissionArray [ 'allowed_locations_tags' ] = array ( $ limitTag ) ; break ; } } } } if ( ! empty ( $ permissionArray [ 'allowed_locations' ] ) ) $ permissionArray [ 'can_add' ] = true ; return $ permissionArray ; }
Returns the array with permission info for linking tags to current content object attribute

@return array
Returns the array with permission info for linking tags to current content object attribute