Skip to content

Renderer

The module provides rendering functionality for Prismic content through various components and blocks.

Components

Page Renderer

Handles the main page rendering for Prismic content.

Block Renderer

Manages individual block rendering within Prismic content.

Template Integration

Integrates with Magento's template system.

Implementation

Page Rendering

public function renderPageByUid(string $uid, string $contentType = null)
{
    // Fetch and render document
}

Block Rendering

public function fetchDocumentView(): string
{
    // Render document blocks
}

Layout Integration

Default Layout

<page>
    <body>
        <referenceContainer name="content">
            <container name="prismicio_content" />
        </referenceContainer>
    </body>
</page>

Content Types

<handle id="prismicio_by_type_blog_post">
    <reference name="content">
        <block class="Elgentos\PrismicIO\Block\Template" 
               template="blog/post.phtml"/>
    </reference>
</handle>

Best Practices

  1. Performance
  2. Implement caching
  3. Optimize rendering
  4. Handle large documents

  5. Template Structure

  6. Maintain hierarchy
  7. Use proper blocks
  8. Document templates

  9. Error Handling

  10. Graceful fallbacks
  11. Clear error messages
  12. Debug information