Overwrite a function

Hello, I’m want to overwrite a function in the modulefactory (getAssignableModules()) and followed the developer doc’s extending Xibo.
custom\settings-custom.php
$MyCustomMiddlewareName = new \Xibo\Custom\Middleware();
$MyMiddleware = $MyCustomMiddlewareName ;

custom\MyMiddleware .php

use Psr\Http\Server\MiddlewareInterface as Middleware; <-???

class MyMiddleware implements Middleware
{

}

Then I would need to implement the function process(). The ‘xibo extend’ documentation is not clear about this.
Do you have an complete example code for extending xibo in stead of a code snippet?

Hi bert,

It isn’t possible to overwrite this function with custom middleware.

What are you trying to achieve?

Thanks,
Dan

Hi Dan,

I want to restrict the number of modules for a standard user. The user only needs text and image. For this particilar issue I can find another solution, but …

I also like to work with extended functionionality. I tried the example in de developers doc " * [Custom Display Profiles]" (Create Custom Display Profiles | Xibo Digital Signage). But I cannot get it to work. The code is not complete and I keep running into errors like: the function process() must be implemented.

A complete, working example with settings-custom.php and yourCustomMiddlewareClassName.php would be very helpfull.

Thanks for the feedback - we’re working on improvements to our developer documentation for Xibo v4, which will be out soon.

Much of the “extending” section (middleware / application structure) is the same, so you may also be able to use those example for v3.

Thanks. I’ll give it a try.
Need to give you feedback and example if it is working?

We’re always happy to take feedback if you have the time! We really want our developer tools to be as simple as they can be, so that starts with the docs.

If you watch out for when v4 is released (4th September) you should see the docs get updated at that time.

Thanks.

I’ll wait for v4.

1 Like