protected function _isAllowed($parent, $tag) {
        $filter = $this->getFilterByTag($tag);

        if (!$filter) {
            return false;
        }

        $child = $filter->getTag($tag);

        // Remove children after a certain nested depth
        if (isset($parent['currentDepth']) && $parent['maxChildDepth'] >= 0 && $parent['currentDepth'] > $parent['maxChildDepth']) {
            return false;

        // Children that can only be within a certain parent
        } else if ($child['parent'] && !in_array($parent['tag'], $child['parent'])) {
            return false;

        // Parents that can not have specific direct descendant children
        } else if ($parent['childrenBlacklist'] && in_array($child['tag'], $parent['childrenBlacklist'])) {
            return false;

        // Parents that can only have direct descendant children
        } else if ($parent['childrenWhitelist'] && !in_array($child['tag'], $parent['childrenWhitelist'])) {
            return false;
        }

        // Validate the type nesting
        switch ($parent['allowedTypes']) {
            case self::TYPE_INLINE:
                // Inline type only allowed
                if ($child['displayType'] === self::TYPE_INLINE) {
                    return true;
                }
            break;
            case self::TYPE_BLOCK:
                // Block types only allowed if the parent is also a block
                if ($parent['displayType'] === self::TYPE_BLOCK && $child['displayType'] === self::TYPE_BLOCK) {
                    return true;
                }
            break;
            case self::TYPE_BOTH:
                if ($parent['displayType'] === self::TYPE_INLINE) {
                    // Only allow inline if parent is inline
                    if ($child['displayType'] === self::TYPE_INLINE) {
                        return true;
                    }
                } else {
                    return true;
                }
            break;
        }

        // Log the error
        $this->_errors[] = array(
            'type' => self::ERROR_SCOPE,
            'parent' => $parent['tag'],
            'parentType' => $parent['displayType'],
            'parentAllowed' => $parent['allowedTypes'],
            'child' => $child['tag'],
            'childType' => $child['displayType']
        );

        return false;
    }
protected function _isAllowed($parent, $tag) {
        $filter = $this->getFilterByTag($tag);

        if (!$filter) {
            return false;
        }

        $child = $filter->getTag($tag);

        // Remove children after a certain nested depth
        if (isset($parent['currentDepth']) && $parent['maxChildDepth'] >= 0 && $parent['currentDepth'] > $parent['maxChildDepth']) {
            return false;

        // Children that can only be within a certain parent
        } else if ($child['parent'] && !in_array($parent['tag'], $child['parent'])) {
            return false;

        // Parents that can not have specific direct descendant children
        } else if ($parent['childrenBlacklist'] && in_array($child['tag'], $parent['childrenBlacklist'])) {
            return false;

        // Parents that can only have direct descendant children
        } else if ($parent['childrenWhitelist'] && !in_array($child['tag'], $parent['childrenWhitelist'])) {
            return false;
        }

        // Validate the type nesting
        switch ($parent['allowedTypes']) {
            case self::TYPE_INLINE:
                // Inline type only allowed
                if ($child['displayType'] === self::TYPE_INLINE) {
                    return true;
                }
            break;
            case self::TYPE_BLOCK:
                // Block types only allowed if the parent is also a block
                if ($parent['displayType'] === self::TYPE_BLOCK && $child['displayType'] === self::TYPE_BLOCK) {
                    return true;
                }
            break;
            case self::TYPE_BOTH:
                if ($parent['displayType'] === self::TYPE_INLINE) {
                    // Only allow inline if parent is inline
                    if ($child['displayType'] === self::TYPE_INLINE) {
                        return true;
                    }
                } else {
                    return true;
                }
            break;
        }

        // Log the error
        $this->_errors[] = array(
            'type' => self::ERROR_SCOPE,
            'parent' => $parent['tag'],
            'parentType' => $parent['displayType'],
            'parentAllowed' => $parent['allowedTypes'],
            'child' => $child['tag'],
            'childType' => $child['displayType']
        );

        return false;
    }
protected function _isAllowed ( $ parent , $ tag ) { $ filter = $ this -> getFilterByTag ( $ tag ) ; if ( ! $ filter ) { return false ; } $ child = $ filter -> getTag ( $ tag ) ; // Remove children after a certain nested depth if ( isset ( $ parent [ 'currentDepth' ] ) && $ parent [ 'maxChildDepth' ] >= 0 && $ parent [ 'currentDepth' ] > $ parent [ 'maxChildDepth' ] ) { return false ; // Children that can only be within a certain parent } else if ( $ child [ 'parent' ] && ! in_array ( $ parent [ 'tag' ] , $ child [ 'parent' ] ) ) { return false ; // Parents that can not have specific direct descendant children } else if ( $ parent [ 'childrenBlacklist' ] && in_array ( $ child [ 'tag' ] , $ parent [ 'childrenBlacklist' ] ) ) { return false ; // Parents that can only have direct descendant children } else if ( $ parent [ 'childrenWhitelist' ] && ! in_array ( $ child [ 'tag' ] , $ parent [ 'childrenWhitelist' ] ) ) { return false ; } // Validate the type nesting switch ( $ parent [ 'allowedTypes' ] ) { case self :: TYPE_INLINE : // Inline type only allowed if ( $ child [ 'displayType' ] === self :: TYPE_INLINE ) { return true ; } break ; case self :: TYPE_BLOCK : // Block types only allowed if the parent is also a block if ( $ parent [ 'displayType' ] === self :: TYPE_BLOCK && $ child [ 'displayType' ] === self :: TYPE_BLOCK ) { return true ; } break ; case self :: TYPE_BOTH : if ( $ parent [ 'displayType' ] === self :: TYPE_INLINE ) { // Only allow inline if parent is inline if ( $ child [ 'displayType' ] === self :: TYPE_INLINE ) { return true ; } } else { return true ; } break ; } // Log the error $ this -> _errors [ ] = array ( 'type' => self :: ERROR_SCOPE , 'parent' => $ parent [ 'tag' ] , 'parentType' => $ parent [ 'displayType' ] , 'parentAllowed' => $ parent [ 'allowedTypes' ] , 'child' => $ child [ 'tag' ] , 'childType' => $ child [ 'displayType' ] ) ; return false ; }
Validate that the following child can be nested within the parent.

@param array $parent
@param string $tag
@return boolean
Validate that the following child can be nested within the parent .