mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 08:35:00 +00:00
Adding the file for visitor pattern + function that need to be implemented.
This commit is contained in:
35
src/Bundle/ChillMainBundle/Widget/Widgets/WidgetNumber.php
Normal file
35
src/Bundle/ChillMainBundle/Widget/Widgets/WidgetNumber.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Widget\Widgets;
|
||||
|
||||
use Chill\MainBundle\Widget\WidgetProviderInterface;
|
||||
|
||||
class WidgetNumber implements WidgetProviderInterface{
|
||||
public function supports($data, $context): bool
|
||||
{
|
||||
// Check if the context is "number"
|
||||
return $context === 'number';
|
||||
}
|
||||
|
||||
public function getDataForWidget($data): array
|
||||
{
|
||||
// Process the data for the number widget
|
||||
// We suppose that its only a single number
|
||||
$numberData = $data['number'];
|
||||
|
||||
// Return the widget data as an associative array
|
||||
return [
|
||||
'type' => 'number',
|
||||
'data' => $numberData,
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user