Task 7 - Add sponsors
This commit is contained in:
parent
a024466201
commit
acac7e6ec1
10 changed files with 238 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
|||
"symfony/maker-bundle": "^1.26",
|
||||
"symfony/twig-bundle": "5.2.*",
|
||||
"symfony/yaml": "5.2.*",
|
||||
"tightenco/collect": "^8.19",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
|
|
52
composer.lock
generated
52
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "78370320905a72a021718c801ce79a79",
|
||||
"content-hash": "4bd1788348537b838b512b44b6eda8e4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
|
@ -3135,6 +3135,56 @@
|
|||
],
|
||||
"time": "2020-12-08T17:02:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tightenco/collect",
|
||||
"version": "v8.19.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tighten/collect.git",
|
||||
"reference": "0c0243a0dc0b66f54d0ec409f36cd9889665b132"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tighten/collect/zipball/0c0243a0dc0b66f54d0ec409f36cd9889665b132",
|
||||
"reference": "0c0243a0dc0b66f54d0ec409f36cd9889665b132",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2|^8.0",
|
||||
"symfony/var-dumper": "^3.4 || ^4.0 || ^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.0",
|
||||
"nesbot/carbon": "^2.23.0",
|
||||
"phpunit/phpunit": "^8.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Collect/Support/helpers.php",
|
||||
"src/Collect/Support/alias.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Tightenco\\Collect\\": "src/Collect"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Collect - Illuminate Collections as a separate package.",
|
||||
"keywords": [
|
||||
"collection",
|
||||
"laravel"
|
||||
],
|
||||
"time": "2020-12-19T00:06:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/extra-bundle",
|
||||
"version": "v3.1.1",
|
||||
|
|
|
@ -2,3 +2,4 @@ twig:
|
|||
default_path: '%kernel.project_dir%/templates'
|
||||
globals:
|
||||
menu_items: '@App\Repository\MenuItemRepository'
|
||||
sponsors: '@App\Repository\SponsorRepository'
|
||||
|
|
17
src/Collection/SponsorCollection.php
Normal file
17
src/Collection/SponsorCollection.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Collection;
|
||||
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
final class SponsorCollection extends Collection
|
||||
{
|
||||
public function byType(string $type): self
|
||||
{
|
||||
return $this->filter(function (array $sponsor) use ($type): bool {
|
||||
return $sponsor['type'] == $type;
|
||||
});
|
||||
}
|
||||
}
|
111
src/Repository/SponsorArrayRepository.php
Normal file
111
src/Repository/SponsorArrayRepository.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Collection\SponsorCollection;
|
||||
|
||||
final class SponsorArrayRepository implements SponsorRepository
|
||||
{
|
||||
private const TYPE_PLATINUM = 'platinum';
|
||||
private const TYPE_GOLD = 'gold';
|
||||
private const TYPE_SILVER = 'silver';
|
||||
private const TYPE_BRONZE = 'bronze';
|
||||
private const TYPE_IN_KIND = 'in_kind';
|
||||
|
||||
private const SPONSORS = [
|
||||
[
|
||||
'name' => 'DDEV',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/ddev1000.png',
|
||||
'type' => self::TYPE_PLATINUM,
|
||||
],
|
||||
[
|
||||
'name' => 'Acquia',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/Acquia_no_tagline.png',
|
||||
'type' => self::TYPE_GOLD,
|
||||
],
|
||||
[
|
||||
'name' => 'Palantir.net',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/palantir-logo_0.png',
|
||||
'type' => self::TYPE_GOLD,
|
||||
],
|
||||
[
|
||||
'name' => 'Drupal Contractors, by esteemed',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/dcont-logo-v1-stacked-black-01.png',
|
||||
'type' => self::TYPE_GOLD,
|
||||
],
|
||||
[
|
||||
'name' => 'Lullabot',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/lullabot.jpg',
|
||||
'type' => self::TYPE_GOLD,
|
||||
],
|
||||
[
|
||||
'name' => 'Florida Realtors Association',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/florida-realtors-logo.png',
|
||||
'type' => self::TYPE_SILVER,
|
||||
],
|
||||
[
|
||||
'name' => 'DrupalEasy',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/DrupalEasy%20CMYK%20Layered_0.png',
|
||||
'type' => self::TYPE_SILVER,
|
||||
],
|
||||
[
|
||||
'name' => 'Specbee',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/SpecbeeLogo-800x800.png',
|
||||
'type' => self::TYPE_SILVER,
|
||||
],
|
||||
[
|
||||
'name' => 'devPanel',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/logo_devPanel_800x800_3.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'Promet Source',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/Promet_Logo_Master-04.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'Hot Sauce',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/hotsauce_logo.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'CLoud NYNE Design',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/CLoud-NYNE-Design.jpg',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'Bluehorn Digital',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/Bluehorn%20Digital%20Logo%20-%204C.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'Pantheon',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/newlogo-webops_New%20logo%20-black%20fist%20tagline.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'DesignHammer',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/DesignHammer%20%281%29.png',
|
||||
'type' => self::TYPE_BRONZE,
|
||||
],
|
||||
[
|
||||
'name' => 'The Weekly Drop',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/twd-square-logo.png',
|
||||
'type' => self::TYPE_IN_KIND,
|
||||
],
|
||||
[
|
||||
'name' => 'Kanopi Studios',
|
||||
'logo_url' => 'https://www.fldrupal.camp/sites/default/files/styles/medium/public/Kanopi_Logo_Horiz_RGB.png',
|
||||
'type' => self::TYPE_IN_KIND,
|
||||
]
|
||||
];
|
||||
|
||||
public function findByType(string $type): array
|
||||
{
|
||||
$sponsors = new SponsorCollection(self::SPONSORS);
|
||||
|
||||
return $sponsors->byType($type)->toArray();
|
||||
}
|
||||
}
|
8
src/Repository/SponsorRepository.php
Normal file
8
src/Repository/SponsorRepository.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
interface SponsorRepository
|
||||
{
|
||||
public function findByType(string $type): array;
|
||||
}
|
|
@ -209,6 +209,9 @@
|
|||
"symfony/yaml": {
|
||||
"version": "v5.2.1"
|
||||
},
|
||||
"tightenco/collect": {
|
||||
"version": "v8.19.0"
|
||||
},
|
||||
"twig/extra-bundle": {
|
||||
"version": "v3.1.1"
|
||||
},
|
||||
|
|
30
templates/includes/home/sponsors.html.twig
Normal file
30
templates/includes/home/sponsors.html.twig
Normal file
|
@ -0,0 +1,30 @@
|
|||
<div>
|
||||
<h2>Sponsors</h2>
|
||||
|
||||
<div>
|
||||
{% include 'includes/sponsor-list.html.twig' with {
|
||||
title: 'Platinum Sponsors',
|
||||
type: 'platinum',
|
||||
} only %}
|
||||
|
||||
{% include 'includes/sponsor-list.html.twig' with {
|
||||
title: 'Gold Sponsors',
|
||||
type: 'gold',
|
||||
} only %}
|
||||
|
||||
{% include 'includes/sponsor-list.html.twig' with {
|
||||
title: 'Silver Sponsors',
|
||||
type: 'silver',
|
||||
} only %}
|
||||
|
||||
{% include 'includes/sponsor-list.html.twig' with {
|
||||
title: 'Bronze Sponsors',
|
||||
type: 'bronze',
|
||||
} only %}
|
||||
|
||||
{% include 'includes/sponsor-list.html.twig' with {
|
||||
title: 'In Kind Sponsors',
|
||||
type: 'in_kind',
|
||||
} only %}
|
||||
</div>
|
||||
</div>
|
14
templates/includes/sponsor-list.html.twig
Normal file
14
templates/includes/sponsor-list.html.twig
Normal file
|
@ -0,0 +1,14 @@
|
|||
<div>
|
||||
<h2>{{ title }}</h2>
|
||||
|
||||
<ul>
|
||||
{% for sponsor in sponsors.findByType(type) %}
|
||||
<li>
|
||||
<a href="#0">
|
||||
<img src="{{ sponsor.logo_url }}" alt="">
|
||||
<p>{{ sponsor.name }}</p>
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
|
@ -4,4 +4,6 @@
|
|||
{% include 'includes/home/video.html.twig' %}
|
||||
|
||||
{% include 'includes/home/intro-text.html.twig' %}
|
||||
|
||||
{% include 'includes/home/sponsors.html.twig' %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue