Adjusting thigns to go to queue.
This commit is contained in:
@@ -25,3 +25,12 @@ function dc_core_taxo_form_submit($form, &$form_state) {
|
||||
|
||||
}
|
||||
|
||||
function dc_core_theme() {
|
||||
return [
|
||||
'lotr_characters' => [
|
||||
'variables' => [
|
||||
'characters' => [],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -411,7 +411,23 @@ trait LotrCharacterList {
|
||||
'bio' => 'Gothmog was the Lieutenant of Morgul and a high-ranking commander of Sauron’s forces in the War of the Ring. As one of the more prominent Orc leaders, he was present during the Battle of the Pelennor Fields, leading the forces of Mordor. Gothmog’s grotesque appearance and ruthlessness made him a terrifying figure. He met his end in the Battle of the Black Gate, where his forces were destroyed and he himself was slain by the armies of Gondor and Rohan.',
|
||||
'image_url' => 'https://vignette.wikia.nocookie.net/lotr/images/9/94/Gothmog_Lieutenant_of_Morgul.png/revision/latest/scale-to-width-down/350?cb=20190602142219',
|
||||
'youtube_url' => 'https://www.youtube.com/watch?v=hegeHfK5Dh4'
|
||||
]
|
||||
],
|
||||
[
|
||||
'name' => 'Dan Chadwick',
|
||||
'species' => 'Human',
|
||||
'height' => 'Huge',
|
||||
'hair' => 'Brown',
|
||||
'eyes' => 'Blue',
|
||||
'birth' => 'Unknown',
|
||||
'death' => 'Unknown, last seen leaving Middle-earth',
|
||||
'title' => 'Drupalist',
|
||||
'occupation' => 'Strugglbus',
|
||||
'affiliation' => 'Twilight new moon',
|
||||
'bio' => 'I am not sure what to put here.',
|
||||
'image_url' => 'https://platform.polygon.com/wp-content/uploads/sites/2/chorus/uploads/chorus_asset/file/22263166/lotr3_movie_screencaps.com_10384.jpg',
|
||||
'youtube_url' => ''
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
return $characters;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\dc_core\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\Attribute\Block;
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
|
||||
#[Block(
|
||||
id: "characters_block",
|
||||
admin_label: new TranslatableMarkup("LOTR Characters"),
|
||||
category: new TranslatableMarkup("DC Core")
|
||||
)]
|
||||
final class CharactersBlock extends BlockBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build(): array {
|
||||
$path = 'public://api-responses/characters.json';
|
||||
$characters = json_decode(file_get_contents($path), TRUE);
|
||||
|
||||
$build = [
|
||||
'#theme' => 'lotr_characters',
|
||||
'#characters' => $characters,
|
||||
];
|
||||
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% for character in characters %}
|
||||
<h2>{{ character.name }}</h2>
|
||||
<h4>{{ character.title }}</h4>
|
||||
<p>{{ character.bio }}</p>
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user