src/Widgets.php
public static function get()
    {
        $widgets = [];
        foreach (Packages::all() as $package) {
            $dir = __DIR__.'/../../'.$package.'/src';
            $files = is_dir($dir) ? scandir($dir) : [];

            foreach ($files as $file) {
                if ($file == 'Widgets.json') {
                    $file_r = file_get_contents($dir.'/'.$file);
                    foreach (json_decode($file_r, true) as $w) {
                        $w['package'] = $package;
                        array_push($widgets, $w);
                    }
                    break;
                }
            }
        }

        $widgets = static::orderByPreference($widgets);

        return $widgets;
    }
public static function get()
    {
        $widgets = [];
        foreach (Packages::all() as $package) {
            $dir = __DIR__.'/../../'.$package.'/src';
            $files = is_dir($dir) ? scandir($dir) : [];

            foreach ($files as $file) {
                if ($file == 'Widgets.json') {
                    $file_r = file_get_contents($dir.'/'.$file);
                    foreach (json_decode($file_r, true) as $w) {
                        $w['package'] = $package;
                        array_push($widgets, $w);
                    }
                    break;
                }
            }
        }

        $widgets = static::orderByPreference($widgets);

        return $widgets;
    }
public static function get ( ) { $ widgets = [ ] ; foreach ( Packages :: all ( ) as $ package ) { $ dir = __DIR__ . '/../../' . $ package . '/src' ; $ files = is_dir ( $ dir ) ? scandir ( $ dir ) : [ ] ; foreach ( $ files as $ file ) { if ( $ file == 'Widgets.json' ) { $ file_r = file_get_contents ( $ dir . '/' . $ file ) ; foreach ( json_decode ( $ file_r , true ) as $ w ) { $ w [ 'package' ] = $ package ; array_push ( $ widgets , $ w ) ; } break ; } } } $ widgets = static :: orderByPreference ( $ widgets ) ; return $ widgets ; }
Returns all the widgets.
Returns all the widgets .