mirror of
https://github.com/scummvm/scummvm-web.git
synced 2026-05-21 05:40:47 +00:00
41f028310c
This removes the hard requirements on pecl modules making development easier.
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
namespace ScummVM\Models;
|
|
|
|
use ScummVM\Objects\WebLink;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
|
|
/**
|
|
* The LinksModel class will generate WebLink objects.
|
|
* LinkGroup-objects representing a group of external links on the website.
|
|
*/
|
|
class LinksModel extends BasicModel
|
|
{
|
|
/* Get all the groups and the respectively demos. */
|
|
public function getAllGroupsAndLinks()
|
|
{
|
|
$entries = $this->getFromCache();
|
|
if (is_null($entries)) {
|
|
$fname = $this->getLocalizedFile('links.yaml');
|
|
$parsedData = Yaml::parseFile($fname);
|
|
$entries = [];
|
|
foreach ($parsedData as $value) {
|
|
/* Get all links. */
|
|
$links = [];
|
|
foreach ($value['links'] as $data) {
|
|
$links[] = new WebLink($data);
|
|
}
|
|
$entries[] = [
|
|
'name' => $value['name'],
|
|
'description' => $value['description'],
|
|
'links' => $links,
|
|
];
|
|
}
|
|
$this->saveToCache($entries);
|
|
}
|
|
return $entries;
|
|
}
|
|
}
|