IContentVisitor Interface

An interface for a visitor that can be passed to the traverseContent function to be called on each piece of content.

The order of calls when using the visitor with traverseContent or traverseContentItem:

startContent
  processFieldHierarchies
  for each content item:
    startItem
    for each field in root level:
      for each category in field's category stack from root to field's category:
        startCategory
      startField
        valueProcessing:
          if item's value for this field is merged:
            processMergedValue
          else if the field is struct:
            startStruct
            for each struct member:
              recurse into the valueProcessing step
            finishStruct
          else if the field is array:
            startArray
            for each array item:
              recurse into the valueProcessing step
            finishArray
          else if the field is primitive:
            processPrimitiveValue
      finishField
    finishItem
finishContent

Methods

Name Description
finishArray(): void Called after processing of array value is complete.  
finishCategory(): void Called after processing of field is complete for every category in the field's category stack.  
finishContent(): void Called after processing of Content is complete.  
finishField(): void Called after processing of Field for individual Item is complete.  
finishItem(): void Called after processing of Item is complete.  
finishStruct(): void Called after processing of struct value is complete.  
processFieldHierarchies(props: ProcessFieldHierarchiesProps): void Called to post-process field hierarchies after they're extracted from Descriptor in processed Content.  
processMergedValue(props: ProcessMergedValueProps): void Called to process a merged value.  
processPrimitiveValue(props: ProcessPrimitiveValueProps): void Called to process a primitive value.  
startArray(props: StartArrayProps): boolean Called before processing an array value.  
startCategory(props: StartCategoryProps): boolean Called before processing a content item field (IContentVisitor.startField call) for each category in the field's  
startContent(props: StartContentProps): boolean Called before starting Content processing.  
startField(props: StartFieldProps): boolean Called before starting Field processing for each individual Item.  
startItem(props: StartItemProps): boolean Called before starting each Item processing.  
startStruct(props: StartStructProps): boolean Called before processing a struct value.  

Defined in

Last Updated: 30 November, 2023