Commit current progress.

This commit is contained in:
calcu1on 2025-03-23 08:44:18 -04:00
parent e3425095dd
commit bef289950b
9 changed files with 145 additions and 30 deletions

View File

@ -11,29 +11,17 @@ function dc_core_page_attachments(array &$attachments) {
} }
} }
function dc_core_views_pre_view(ViewExecutable $view) { function dc_core_form_taxonomy_term_ufc_events_form_alter(&$form, &$form_state, $form_id) {
if ($view->id() !== 'floorplans_by_property') { $form['actions']['refresh'] = array(
return; '#type' => 'submit',
} '#value' => t('Refresh Property'),
$cur_node = \Drupal::routeMatch()->getParameter('node'); '#access' => TRUE,
if (!$cur_node instanceof \Drupal\node\NodeInterface) { '#submit' => ['dc_core_taxo_form_submit'],
return; '#weight' => -30,
} );
if (!$cur_node->hasField('field_property')) {
return;
}
// current property.
$property = $cur_node->get('field_property')->first()->getValue()['target_id'] ?? FALSE;
assert(!is_null($property));
$increased_price_data = [
];
$exposed_input = $view->getExposedInput();
if (isset($exposed_input['field_price_value'])) {
$filters = $view->display_handler->getOption('filters');
$filters['field_price_value']['group_info']['group_items'][3]['title'] = "339+";
$filters['field_price_value']['group_info']['group_items'][3]['value']['value'] = 339;
$view->display_handler->overrideOption('filters', $filters);
}
} }
function dc_core_taxo_form_submit($form, &$form_state) {
}

View File

@ -15,7 +15,7 @@ final class CharacterImport extends DrushCommands {
public function importCharacters(): void { public function importCharacters(): void {
$http_client = \Drupal::httpClient(); $http_client = \Drupal::httpClient();
$character_endpoint = "https://dchadwick.ddev.site/api/character-list"; $character_endpoint = "https://dchadwick.ddev.site/api/character-list";
$data = $http_client->get($character_endpoint)->getBody()->getContents(); $data = $http_client->get($character_endpoint, ['verify'=>FALSE,])->getBody()->getContents();
$json_data = json_decode($data, TRUE); $json_data = json_decode($data, TRUE);
// Create the queue. // Create the queue.
$character_import_queue = \Drupal::queue('character_import'); $character_import_queue = \Drupal::queue('character_import');

View File

@ -0,0 +1,31 @@
<?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: "copyright_block",
admin_label: new TranslatableMarkup("Copyright Block"),
category: new TranslatableMarkup("DC Core")
)]
final class CopyrightBlock extends BlockBase {
/**
* {@inheritdoc}
*/
public function build(): array {
$year = date('Y');
"<p>&#169; Dan Chadwick {$year}</p>";
$build = [
'#markup' => "<p>&#169; Dan Chadwick {$year}</p>",
];
return $build;
}
}

View File

@ -107,6 +107,9 @@ public function setFighterPage(string $url): void {
* Checks is the fighters has stats to pull before proceeding. * Checks is the fighters has stats to pull before proceeding.
*/ */
public function checkValidFighter(): bool { public function checkValidFighter(): bool {
if (!$this->crawler) {
return FALSE;
}
$athlete_stats = $this->crawler->filter('h2.stats-records__title')->count(); $athlete_stats = $this->crawler->filter('h2.stats-records__title')->count();
if ($athlete_stats == 0) { if ($athlete_stats == 0) {
return FALSE; return FALSE;

View File

@ -163,6 +163,9 @@ private function removeExistingEvents(): void {
*/ */
public static function createFightsByEvent($event, $context): void { public static function createFightsByEvent($event, $context): void {
try { try {
/* \Drupal::messenger()->addStatus(print_r($event->field_event_url->uri)); */
/* \Drupal::messenger()->addStatus(print_r($event->label())); */
/* exit(); */
$event_page_html = \Drupal::httpClient() $event_page_html = \Drupal::httpClient()
->get(self::EVENT_BASE . $event->field_event_url->uri) ->get(self::EVENT_BASE . $event->field_event_url->uri)
->getBody()->getContents(); ->getBody()->getContents();

View File

@ -98,9 +98,9 @@ public function importFighters(): void {
else { else {
$fighters_by_div = self::getListOfCurrentFighters(); $fighters_by_div = self::getListOfCurrentFighters();
// Process each fighter into system. // Process each fighter into system.
/* foreach ($fighters_by_div as $division => $fighters) { */ foreach ($fighters_by_div as $division => $fighters) {
/* $this->processDivision($division, $fighters); */ $this->processDivision($division, $fighters);
/* } */ }
} }
} }
/** /**
@ -109,7 +109,7 @@ public function importFighters(): void {
* @param mixed $div * @param mixed $div
* @param mixed $fighters * @param mixed $fighters
*/ */
public static function processDivision($div, $fighters, &$context): void { public static function processDivision($div, $fighters): void {
\Drupal::logger('ufc')->notice("Starting to update $div"); \Drupal::logger('ufc')->notice("Starting to update $div");
foreach ($fighters as $fighter_data) { foreach ($fighters as $fighter_data) {

View File

@ -601,6 +601,41 @@ table.cols-5 td.incorrect {
line-height: 24px; line-height: 24px;
} }
.margin-1 {
margin: 1rem;
}
.margin-2 {
margin: 2rem;
}
.m-top-1 {
margin-top: 1rem;
}
.m-top-2 {
margin-top: 2rem;
}
.m-bottom-1 {
margin-bottom: 1rem;
}
.m-bottom-2 {
margin-bottom: 2rem;
}
.padding-1 {
padding: 1rem;
}
.padding-2 {
padding: 2rem;
}
.p-topbottom-1 {
padding: 1rem 0;
}
.p-topbottom-2 {
padding: 2rem 0;
}
html { html {
font-size: 100%; font-size: 100%;
box-sizing: border-box; box-sizing: border-box;

View File

@ -0,0 +1,54 @@
.margin {
&-1 {
margin: 1rem;
}
&-2 {
margin: 2rem;
}
}
.m-top {
&-1 {
margin-top: 1rem;
}
&-2 {
margin-top: 2rem;
}
}
.m-bottom {
&-1 {
margin-bottom: 1rem;
}
&-2 {
margin-bottom: 2rem;
}
}
.padding {
&-1 {
padding: 1rem;
}
&-2 {
padding: 2rem;
}
}
.p-topbottom {
&-1 {
padding: 1rem 0;
}
&-2 {
padding: 2rem 0;
}
}

View File

@ -49,6 +49,7 @@ $container-plus-padding: 1216px;
@import "partials/article"; @import "partials/article";
@import "partials/breadcrumbs"; @import "partials/breadcrumbs";
@import "partials/characters"; @import "partials/characters";
@import "partials/lb-styles";
html { html {
font-size: 100%; font-size: 100%;