Skip to main content

Creating a View Page

View pages display records in read-only mode. Generate one when creating a resource:
Or add it to an existing resource:
Then register it in getPages():

The View Page Class

packages/panels/src/Resources/Pages/ViewRecord.php

Display Options

By default, View pages show a disabled version of the Edit form:
The form is automatically disabled:
packages/panels/src/Resources/Pages/ViewRecord.php

Infolist Components

Infolist entries are optimized for displaying data:

Customizing Data Before Fill

When using a disabled form (not an infolist), you can modify data before it’s displayed:

Lifecycle Hooks

Available hooks when using a disabled form:
packages/panels/src/Resources/Pages/ViewRecord.php

Header Actions

Add actions to the page header:

Viewing in Modals

For simple resources, view records in modals instead of dedicated pages:
  1. Delete the View page file
  2. Remove it from getPages()
  3. Add a ViewAction to your table:

Multiple View Pages

Create separate View pages for different aspects of a record:
1

Generate additional page

2

Register it

3

Define its content

Customizing Relation Managers

Show different relation managers on different View pages:

Adding to Sub-Navigation

When using resource sub-navigation, register View pages:

Page Content

The default View page schema:
packages/panels/src/Resources/Pages/ViewRecord.php
Add custom components:

Authorization

Users can access the View page if the view() method of the model policy returns true:

Read-Only Mode

View pages are read-only by default. Actions that modify data are automatically hidden. Relation managers also become read-only on View pages unless you override:
Or globally disable this behavior: