PHP code example of marcel-mathias-nolte / contao-filesmanager-fileusage

1. Go to this page and download the library: Download marcel-mathias-nolte/contao-filesmanager-fileusage 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/ */

    

marcel-mathias-nolte / contao-filesmanager-fileusage example snippets


$GLOBALS['FILE_USAGE']['TABELLENNAME'] = [
    // optional: Spalte(n) zur Benennung des Eintrags,
    // wenn eine Spalte keinen Inhalt hat wird die jeweils nächste genutzt
    'labelColumn' => ['title'],
    // optionale Referenz, falls die Spalte 'type' vorhanden ist
    'ref' => &$GLOBALS['TL_LANG']['REFERENZTABELLE'],
    // Name der Elterntabelle
    'parent' => 'ELTERNTABELLE',
    // oder false, wenn es keine Elterntabelle gibt
    'parent' => false,
    // , oder 'dynamic', falls die Elterntabelle anhand der Spalte ptable gewählt werden soll
    'parent' => 'dynamic',
    // optional: Bearbeitungslink
    // %id% und %pid% werden ersetzt
    'href' => '/contao?do=MODULNAME&table=TABELLENNAME&id=%id%&act=edit',
    // für von der Spalte 'ptable' abhängige Links muss ein Array genutzt werden:
    'href' => [
        'ELTERNTABELLE' => '/contao?do=MODULNAME&table=TABELLENNAME&id=%id%&act=edit'
    ]
];

$GLOBALS['FILE_USAGE']['tl_content'] = [
    'ref' => &$GLOBALS['TL_LANG']['CTE'],
    'parent' => 'dynamic',
    'href' => [
        'tl_article' => '/contao?do=article&table=tl_content&id=%id%&act=edit',
        'tl_news' => '/contao?do=news&table=tl_content&id=%id%&act=edit',
        'tl_calendar_events' => '/contao?do=calendar&table=tl_content&id=%id%&act=edit',
        'tl_newsletter' => '/contao?do=newsletter&table=tl_content&id=%id%&act=edit'
    ]
];

$GLOBALS['FILE_USAGE']['tl_user'] = [
    'labelColumn' => ['username'],
    'parent' => false,
    'href' => '/contao?do=user&act=edit&id=%id%'
];

$GLOBALS['TL_LANG']['FILE_USAGE']['TABELLENNAME'] = 'TABELLENBEZEICHNUNG';

$GLOBALS['TL_LANG']['FILE_USAGE']['tl_user'] = 'Backend-Nutzer';

$GLOBALS['FILE_USAGE']['TABLENAME'] = [
    // optional column(s) to use for labelling the item,
    // if one given column is empty, the next one will be used
    'labelColumn' => ['title'],
    // optional reference, if a type field is present
    'ref' => &$GLOBALS['TL_LANG']['REFERENCE TABLE NAME'],
    // parent tables name
    'parent' => 'PARENTTABLE',
    // or false if there is no parent table
    'parent' => false,
    // or 'dynamic' if the parent tables name should be derived from the ptable field
    'parent' => 'dynamic',
    // optional provide an edit link
    // %id% will
    'href' => '/contao?do=MODULENAME&table=TABLENAME&id=%id%&act=edit',
    // for hrefs based on the ptable use an array:
    'href' => [
        'PARENTTABLE' => '/contao?do=MODULENAME&table=TABLENAME&id=%id%&act=edit'
    ]
];

$GLOBALS['FILE_USAGE']['tl_content'] = [
    'ref' => &$GLOBALS['TL_LANG']['CTE'],
    'parent' => 'dynamic',
    'href' => [
        'tl_article' => '/contao?do=article&table=tl_content&id=%id%&act=edit',
        'tl_news' => '/contao?do=news&table=tl_content&id=%id%&act=edit',
        'tl_calendar_events' => '/contao?do=calendar&table=tl_content&id=%id%&act=edit',
        'tl_newsletter' => '/contao?do=newsletter&table=tl_content&id=%id%&act=edit'
    ]
];

$GLOBALS['FILE_USAGE']['tl_user'] = [
    'labelColumn' => ['username'],
    'parent' => false,
    'href' => '/contao?do=user&act=edit&id=%id%'
];

$GLOBALS['TL_LANG']['FILE_USAGE']['TABLENAME'] = 'ITEMNAME';

$GLOBALS['TL_LANG']['FILE_USAGE']['tl_user'] = 'Backend-User';