-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 4167899d6bef238dc3112da7180abf3e57869ad7 Author: rjkuyvenhoven <[email protected]> Date: Mon Oct 31 14:17:57 2022 -0700 add Trends dates extra field commit 3b72828bc10a02cd31b563f24c844601c9bf92f3 Merge: 4cfec57a e95c532 Author: rjkuyvenhoven <[email protected]> Date: Mon Oct 31 14:14:57 2022 -0700 Merge branch 'master' into wr-936-show-date-ranges commit 4cfec57a2d104f0f7689d3cb2aa736767c6bf491 Author: rjkuyvenhoven <[email protected]> Date: Mon Oct 31 14:14:31 2022 -0700 add Date info for Career & Industry profiles commit b31b9702250198d4dba328c04e1e595059c0f4b0 Merge: b1af9e41 556fbd7 Author: rjkuyvenhoven <[email protected]> Date: Mon Oct 31 10:56:26 2022 -0700 Merge branch 'master' into wr-936-show-date-ranges commit b1af9e410eb4051e35638d215a62cec0ea573ef4 Merge: e66e9e00 b7ad0eb Author: rjkuyvenhoven <[email protected]> Date: Mon Oct 31 09:23:32 2022 -0700 Merge branch 'master' into wr-936-show-date-ranges commit e66e9e00029b22b386694020d0f009ec355f4ddb Author: rjkuyvenhoven <[email protected]> Date: Fri Oct 28 16:58:54 2022 -0700 show date range wip
- Loading branch information
1 parent
e95c532
commit b66c8a5
Showing
21 changed files
with
163 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...lds/src/Plugin/ExtraField/Display/IndustryProfile/IndustryEmploymentLatestTrendsDates.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Drupal\workbc_extra_fields\Plugin\ExtraField\Display\IndustryProfile; | ||
|
||
use Drupal\Core\Entity\ContentEntityInterface; | ||
use Drupal\Core\StringTranslation\StringTranslationTrait; | ||
use Drupal\extra_field\Plugin\ExtraFieldDisplayFormattedBase; | ||
|
||
/** | ||
* Example Extra field with formatted output. | ||
* | ||
* @ExtraFieldDisplay( | ||
* id = "industry_employment_trends_dates", | ||
* label = @Translation("Latest Employment Trends Dates"), | ||
* description = @Translation("An extra field to display industry latest employment trends dates."), | ||
* bundles = { | ||
* "node.industry_profile", | ||
* } | ||
* ) | ||
*/ | ||
class IndustryEmploymentLatestTrendsDates extends ExtraFieldDisplayFormattedBase { | ||
|
||
use StringTranslationTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getLabel() { | ||
|
||
return $this->t('Latest Employment Trends'); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getLabelDisplay() { | ||
|
||
return 'above'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function viewElements(ContentEntityInterface $entity) { | ||
|
||
if (!empty($entity->ssot_data) && isset($entity->ssot_data['monthly_labour_market_updates'])) { | ||
$sourceData = $entity->ssot_data['monthly_labour_market_updates']; | ||
$idx = ssotLatestMonthlyLabourMarketUpdate($entity->ssot_data['monthly_labour_market_updates']); | ||
$date1 = strtotime($entity->ssot_data['monthly_labour_market_updates'][$idx]['year'] . "-" . $entity->ssot_data['monthly_labour_market_updates'][$idx]['month']. "-01", 10); | ||
$date2 = strtotime("-1 month", $date1); | ||
$output = date("M Y", $date1) . " vs. " . date("M Y", $date2); | ||
} | ||
else { | ||
$output = WORKBC_EXTRA_FIELDS_NOT_AVAILABLE; | ||
} | ||
return [ | ||
['#markup' => $output], | ||
]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.