Json
extends AbstractBase
in package
Hierarchy Tree Data Formatter (JSON)
Tags
Table of Contents
- $childMap : array<string|int, mixed>
- Child data map from index
- $collectionType : string
- Collection mode
- $count : int
- How many nodes have we formatted?
- $sort : bool
- Is sorting enabled?
- $sorter : SorterInterface|null
- Sorter
- $topNode : object
- Top-level record from index
- $validateHierarchySequences : bool
- Throw an exception if hierarchy parent and sequence data is out of sync?
- __construct() : mixed
- Constructor
- getCount() : int
- Get number of nodes formatted.
- getData() : string
- Get the formatted metadata.
- getSorter() : SorterInterface
- Get the sorter
- setRawData() : void
- Set raw data.
- setSorter() : void
- Set the sorter
- formatNode() : string
- Get Solr Children for JSON
- getHierarchyPositionsInParents() : array<string|int, mixed>
- Get the positions of this item within parent collections. Returns an array of parent ID => sequence number.
- getTitlesInHierarchy() : array<string|int, mixed>
- Get the titles of this item within parent collections. Returns an array of parent ID => sequence number.
- isCollection() : bool
- Identify whether the provided record is a collection.
- mapChildren() : string
- Get Solr Children for JSON
- pickTitle() : string
- Choose a title for the record.
- sortNodes() : array<string|int, mixed>
- Sort Nodes Convert an unsorted array of [ key, value ] pairs into a sorted array of values.
Properties
$childMap
Child data map from index
protected
array<string|int, mixed>
$childMap
$collectionType
Collection mode
protected
string
$collectionType
$count
How many nodes have we formatted?
protected
int
$count
= 0
$sort
Is sorting enabled?
protected
bool
$sort
$sorter
Sorter
protected
SorterInterface|null
$sorter
= null
$topNode
Top-level record from index
protected
object
$topNode
$validateHierarchySequences
Throw an exception if hierarchy parent and sequence data is out of sync?
protected
bool
$validateHierarchySequences
Methods
__construct()
Constructor
public
__construct([bool $validateHierarchySequences = true ]) : mixed
Parameters
- $validateHierarchySequences : bool = true
-
Throw an exception if hierarchy parent and sequence data is out of sync?
Return values
mixed —getCount()
Get number of nodes formatted.
public
getCount() : int
Return values
int —getData()
Get the formatted metadata.
public
getData() : string
Return values
string —getSorter()
Get the sorter
public
getSorter() : SorterInterface
Return values
SorterInterface —setRawData()
Set raw data.
public
setRawData(object $topNode, array<string|int, mixed> $childMap[, bool $sort = false ][, string $cType = 'All' ]) : void
Parameters
- $topNode : object
-
Full record for top node
- $childMap : array<string|int, mixed>
-
Data map from index
- $sort : bool = false
-
Is sorting enabled?
- $cType : string = 'All'
-
Collection type
Return values
void —setSorter()
Set the sorter
public
setSorter(SorterInterface $sorter) : void
Parameters
- $sorter : SorterInterface
-
Sorter service
Return values
void —formatNode()
Get Solr Children for JSON
protected
formatNode(object $record[, string $parentID = null ]) : string
Parameters
- $record : object
-
Solr record to format
- $parentID : string = null
-
The starting point for the current recursion (equivalent to Solr field hierarchy_parent_id)
Return values
string —getHierarchyPositionsInParents()
Get the positions of this item within parent collections. Returns an array of parent ID => sequence number.
protected
getHierarchyPositionsInParents(object $fields) : array<string|int, mixed>
Parameters
- $fields : object
-
Solr fields
Return values
array<string|int, mixed> —getTitlesInHierarchy()
Get the titles of this item within parent collections. Returns an array of parent ID => sequence number.
protected
getTitlesInHierarchy(object $fields) : array<string|int, mixed>
Parameters
- $fields : object
-
Solr fields
Return values
array<string|int, mixed> —isCollection()
Identify whether the provided record is a collection.
protected
isCollection(object $fields) : bool
NOTE: \VuFind\RecordDriver\SolrDefault::isCollection() duplicates some of
this logic.
Parameters
- $fields : object
-
Solr fields
Return values
bool —mapChildren()
Get Solr Children for JSON
protected
mapChildren(string $parentID) : string
Parameters
- $parentID : string
-
The starting point for the current recursion (equivalent to Solr field hierarchy_parent_id)
Return values
string —pickTitle()
Choose a title for the record.
protected
pickTitle(object $record, string $parentID) : string
Parameters
- $record : object
-
Solr record to format
- $parentID : string
-
The starting point for the current recursion (equivalent to Solr field hierarchy_parent_id)
Return values
string —sortNodes()
Sort Nodes Convert an unsorted array of [ key, value ] pairs into a sorted array of values.
protected
sortNodes(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
-
The array of arrays to sort