PHP code example of heimrichhannot / contao-entity_lock

1. Go to this page and download the library: Download heimrichhannot/contao-entity_lock 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/ */

    

heimrichhannot / contao-entity_lock example snippets

$GLOBALS['TL_CONFIG']['entityLockEntityTitleFields']

    if ($this->addEntityLock && EntityLockModel::isLocked('tl_calendar_events', $objEvent->id, $this))
    {
        // do something like display a message that the entity is locked (or check for lock removal being allowed -> see 4.)
    }
    else
    {
        EntityLockModel::create('tl_calendar_events', $objEvent->id, $this);
    }
    

    EntityLockModel::deleteLocks('tl_calendar_events', $objEvent->id);
    

    $strMessage = EntityLock::generateErrorMessage('tl_calendar_events', $objEvent->id, $this);
    
    if ($this->allowLockDeletion)
    {
        // generateUnlockForm() also does the actual deletion of the lock and the sending of a notification to the former editor
        $strUnlockForm = $this->generateUnlockForm($objItem, $objLock);
        $strMessage .= $strUnlockForm;
    }