PHP code example of inspiredminds / contao-file-usage

1. Go to this page and download the library: Download inspiredminds/contao-file-usage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inspiredminds / contao-file-usage example snippets


// src/FileUsage/FoobarProvider.php
use InspiredMinds\ContaoFileUsage\Provider\FileUsageProviderInterface;
use InspiredMinds\ContaoFileUsage\Result\DatabaseReferenceResult;
use InspiredMinds\ContaoFileUsage\Result\ResultsCollection;

class FoobarProvider implements FileUsageProviderInterface
{
    public function find(): ResultsCollection
    {
        $collection = new ResultsCollection();

        // Additional database search
        // …

        $collection->addResult(new DatabaseReferenceResult($table, $field, $id));

        return $collection;
    }
}