Overview Block
The Overview block (Elgentos\PrismicIO\Block\Overview
) provides functionality for displaying lists or collections of Prismic documents.
Features
- Fetches multiple documents of the same type
- Supports filtering and sorting
- Handles language fallbacks
- Manages document merging
Implementation
Core Methods
public function getDocuments(): array
public function getDocumentsWithoutLanguage(): array
public function buildFilters(): array
public function buildQuery(): array
public function mergeDocuments(\stdClass ...$allDocuments): array
Configuration
<block class="Elgentos\PrismicIO\Block\Overview" name="blog.list">
<arguments>
<argument name="document_type" xsi:type="string">blog_post</argument>
</arguments>
</block>
Usage Examples
Basic Document List
/** @var $block \Elgentos\PrismicIO\Block\Overview */
foreach ($block->getDocuments() as $document) {
// Process each document
}
Filtered List
Custom Options
Best Practices
- Performance
- Use appropriate page sizes
- Implement caching where possible
-
Consider lazy loading
-
Language Handling
- Use proper language fallbacks
- Handle missing translations
-
Consider multi-store setups
-
Query Building
- Keep filters simple
- Use meaningful predicates
- Document query structure