For the complete documentation index, see llms.txt. This page is also available as Markdown.

CMS Events

The Events system in CMS Full Form allows you to execute custom actions when specific system events occur. This enables you to extend and customize the functionality of the CMS without modifying the core source code directly.


Events Directory Structure

application/
└── Events/
    ├── Backend/
    │   ├── ExampleEvent.php
    │   └── ...
    └── Frontend/
        ├── ExampleEvent.php
        └── ...
  • Backend/: Contains events related to the admin panel or backend operations.

  • Frontend/: Contains events related to the public-facing side of the website.


Creating a New Event

Inside the appropriate folder (Backend or Frontend), create a new PHP file for your event, e.g., ExampleEvent.php.

<?php

namespace App\Events\Frontend;

use System\Libraries\Event;

class ExampleEvent extends Event
{
    public function __construct($data)
    {
        $this->data= $data;
    }

    public function handle()
    {
        // Perform an action when the event is triggered
        echo "CMS Full Form Event: Data: " . json_encode($this->data) . "<br>";
    }
}
  • $this->data: Stores the data passed in when the event is triggered.

  • handle(): This method contains the logic that should run when the event is executed.


Using Event


Last updated

Was this helpful?