Filament Plugins

Purchase

Configurable schemas

The Media Library is built entirely using Schema-components which makes it incredibly flexible. This allows you to insert or modify components throughout the entire library.

A configurable schema represent an array of components that are visually related. For example, the "list files" or "file info" (sidebar) component.

Usage

In this example we will take the FileTopbarSchema as an example, which is the section containing the breadcrumbs and the Create folder action. Now, we would like to insert one more action:

php

FileTopbarSchema::configureUsing(function (FileTopbarSchema $configurableSchema) {
    $components = $configurableSchema->getConfiguredComponents();
    
    // Modify `$components`...
    
    $configurableSchema->configuredComponents($components);
});

This gives the following structure of $components:

  • Section
    • Flex
      • Breadcrumbs
      • CreateFolderAction

Then, finally we will insert our custom action class:

php

/** @var Section $sectionComponent */
$sectionComponent = $components[0];

/** @var Flex $flexComponent */
$flexComponent = $sectionComponent->getChildComponents()[0];

[$breadcrumbsComponent, $createFolderAction] = $flexComponent->getChildComponents();

$configurableSchema->configuredComponents([
    $sectionComponent
        ->schema([
            $flexComponent
                ->schema([
                     $breadcrumbsComponent,
                     // Wrap the actions in a group, so that they stay together... 
                     Group::make([
                         CustomAction::make(),
                         $createFolderAction,
                    ]),
                ]),
        ]),
]);

For each configurable schema you can click through to the source of the plugin to verify the exact schema-structure that is returned. Sometimes the structure is quite nested and you need to dig a few levels deep to find the actual content components that you are interested in.

If you require assistance regarding a certain customisation, e-mail me at support@ralphjsmit.com.

Available configurable schemas

The below list gives an overview of the available schemas:

  • ExplorePage\FileTopbarSchema
  • ExplorePage\FileFilterSchema
  • ExplorePage\ListFilesSchema
  • ExplorePage\FileInfoSchema
© FilamentPlugins.com ✦ 2022 – 2025 ✦ All rights reserved.