Skip to content

Commit

Permalink
9.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 13, 2024
1 parent fd0afec commit 17d7b8b
Show file tree
Hide file tree
Showing 25 changed files with 116 additions and 30 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Stanford Profile Helper

9.8.7
--------------------------------------------------------------------------------
_Release Date: 2024-11-13_

- FAQ Accordion heading behavior.

9.8.6
--------------------------------------------------------------------------------
_Release Date: 2024-11-13_
Expand Down
2 changes: 1 addition & 1 deletion modules/jumpstart_ui/jumpstart_ui.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Jumpstart UI'
type: module
description: 'Provides UI Tools for Jumpstart Projects'
package: Stanford
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
dependencies:
- components:components
Expand Down
8 changes: 1 addition & 7 deletions modules/jumpstart_ui/jumpstart_ui.module
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use Drupal\ui_patterns\UiPatterns;
* Implements hook_page_attachments().
*/
function jumpstart_ui_page_attachments(array &$page) {

// It is recommended that you don't just add a library to all pages but
// rather, conditionally require this library only where it is needed.
// See: https://www.drupal.org/node/2274843
Expand All @@ -28,7 +27,6 @@ function jumpstart_ui_page_attachments(array &$page) {
$page['#attached']['library'][] = 'jumpstart_ui/layout';
$page['#attached']['library'][] = 'jumpstart_ui/jumpstart_ui';
}

}

/**
Expand Down Expand Up @@ -73,7 +71,6 @@ function jumpstart_ui_preprocess_ds_entity_view(&$variables) {
* Implements hook_preprocess().
*/
function jumpstart_ui_preprocess(&$variables, $hook) {

// Only want pattern contexts.
if (!(isset($variables['context']) && $variables['context'] instanceof PatternContext)) {
return;
Expand All @@ -82,7 +79,6 @@ function jumpstart_ui_preprocess(&$variables, $hook) {
// Match the hook with a strpos because it is not consistent.
foreach (UiPatterns::getPatternDefinitions() as $pattern_id => $pattern) {
if (str_contains($hook, $pattern_id)) {

if (isset($variables['attributes']['id'])) {
$variables['attributes']['id'] = Html::getUniqueId($variables['attributes']['id']);
}
Expand All @@ -100,9 +96,7 @@ function jumpstart_ui_preprocess(&$variables, $hook) {
* Implements hook_preprocess_patterns_overview_page().
*/
function jumpstart_ui_preprocess_patterns_overview_page(&$variables) {
uasort($variables['patterns'], function ($pattern_a, $pattern_b) {
return strcmp($pattern_a['label'], $pattern_b['label']);
});
uasort($variables['patterns'], fn($pattern_a, $pattern_b) => strcmp($pattern_a['label'], $pattern_b['label']));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace Drupal\jumpstart_ui\Plugin\paragraphs\Behavior;

use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\paragraphs\ParagraphInterface;
use Drupal\paragraphs\ParagraphsBehaviorBase;
use Drupal\paragraphs\ParagraphsTypeInterface;

/**
* Class FaqParagraphBehavior.
*
* @ParagraphsBehavior(
* id = "faq_accordions",
* label = @Translation("FAQ Accordion"),
* description = @Translation("Display options for the FAQ Accordion paragraph.")
* )
*/
class FaqParagraphBehavior extends ParagraphsBehaviorBase {

/**
* {@inheritDoc}
*/
public function defaultConfiguration() {
return ['heading' => 'h2'];
}

/**
* {@inheritDoc}
*/
public static function isApplicable(ParagraphsTypeInterface $paragraphs_type) {
return $paragraphs_type->id() == 'stanford_faq';
}

/**
* {@inheritDoc}
*/
public function buildBehaviorForm(ParagraphInterface $paragraph, array &$form, FormStateInterface $form_state) {
$form = parent::buildBehaviorForm($paragraph, $form, $form_state);
$form['heading'] = [
'#type' => 'select',
'#title' => $this->t('Heading Level'),
'#options' => [
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
],
'#default_value' => $paragraph->getBehaviorSetting('faq_accordions', 'heading', 'h2'),
];
return $form;
}

/**
* {@inheritDoc}
*/
public function view(array &$build, ParagraphInterface $paragraph, EntityViewDisplayInterface $display, $view_mode) {
if (isset($build['su_faq_headline'][0]['#tag'])) {
$build['su_faq_headline'][0]['#tag'] = $paragraph->getBehaviorSetting('faq_accordions', 'heading', 'h2');
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* @ParagraphsBehavior(
* id = "hero_pattern",
* label = @Translation("Hero Pattern"),
* description = @Translation("Display options for the hero pattern
* paragraph.")
* description = @Translation("Display options for the hero pattern paragraph.")
* )
*/
class HeroPatternBehavior extends ParagraphsBehaviorBase {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Basic Page Types'
description: 'Provides support for basic page types in stanford_page nodes'
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
type: module
project: Stanford
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Courses Migration Importer'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- stanford_courses:stanford_courses
- migrate_tools:migrate_tools
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_courses/stanford_courses.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Stanford Courses'
type: module
description: 'Courses content type'
core_version_requirement: ^10.3 || ^11
version: 9.8.6
version: 9.8.7
package: Stanford
dependencies:
- config_pages:config_pages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: 'Stanford Date Formats'
description: 'Date and time formats used by Stanford modules and Themes'
type: module
core_version_requirement: ^10.3 || ^11
version: 9.8.6
version: 9.8.7
package: Stanford
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Stanford Events Importer'
core_version_requirement: ^10.3 || ^11
description: 'Migrate importer for stanford events.'
type: module
version: 9.8.6
version: 9.8.7
package: 'Stanford'
dependencies:
- config_pages:config_pages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Stanford Events Series'
core_version_requirement: ^10.3 || ^11
description: 'A series is a collection of events.'
type: module
version: 9.8.6
version: 9.8.7
package: 'Stanford'
dependencies:
- stanford_events:stanford_events
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_events/stanford_events.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Event content type, views, and importer.'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- address:address
- auto_entitylabel:auto_entitylabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Provides Image Styles'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- drupal:image
- drupal:responsive_image
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_intranet/stanford_intranet.info.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Intranet'
description: 'Locks down access to the entire site if configured.'
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
type: module
project: Stanford
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_news/stanford_news.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Stanford news items and views.'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- auto_entitylabel:auto_entitylabel
- components:components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Stanford Notifications
description: Display a notification icon to the users when something in the platform has changed.
core_version_requirement: ^10.3 || ^11
type: module
version: 9.8.6
version: 9.8.7
package: Stanford
dependencies:
- drupal:user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Paragraph Card'
description: 'Adds helpers and modifications to the card paragraph type.'
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
type: module
project: Stanford
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Migration support for importing of profile information from stanford.edu.'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- 'config_pages:config_pages'
- 'drupal:migrate'
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_person/stanford_person.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'A person bio and supporting information content type'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- auto_entitylabel:auto_entitylabel
- ctools:ctools
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Profile Drush'
description: 'A collection of Drush commands since commands in the profile are not discoverable.'
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
type: module
project: Stanford
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Stanford Profile Styles'
description: 'A module for theming'
version: 9.8.6
version: 9.8.7
core_version_requirement: ^10.3 || ^11
type: module
project: Stanford
26 changes: 25 additions & 1 deletion modules/stanford_publication/src/Entity/Citation.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,21 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
->setSetting('is_ascii', TRUE)
->setSetting('max_length', FieldStorageConfig::NAME_MAX_LENGTH);

$fields['apa'] = BaseFieldDefinition::create('string')
->setLabel(t('apa'))
->setDescription(t('The delta weight of this paragraph within a fielded context.'))
->setComputed(TRUE)
->setClass('\Drupal\text\TextProcessed')
->setSetting('text source', 'value')
->setDefaultValue('');

$fields['chicago'] = BaseFieldDefinition::create('string')
->setLabel(t('chicago'))
->setDescription(t('The delta weight of this paragraph within a fielded context.'))
->setComputed(TRUE)
->setClass('\Drupal\text\TextProcessed')
->setSetting('text source', 'value')
->setDefaultValue('');
return $fields;
}

Expand Down Expand Up @@ -154,11 +169,20 @@ public function setParentEntity(ContentEntityInterface $parent, $parent_field_na
return $this;
}

public function get($field_name) {
// if ($field_name == 'apa') {
// return $this->getBibliography();
// }
// if ($field_name == 'chicago') {
// return $this->getBibliography(Citation::CHICAGO);
// }
return parent::get($field_name); // TODO: Change the autogenerated stub
}

/**
* {@inheritDoc}
*/
public function getBibliography($style = self::APA): string {

$data = [
'id' => $this->id(),
'title' => $this->label(),
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_publication/stanford_publication.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: "Stanford Publications Module."
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- ctools:ctools
- drupal:layout_builder
Expand Down
2 changes: 1 addition & 1 deletion modules/stanford_text_editor/stanford_text_editor.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: 'Stanford Text Editor'
description: 'Input formats and WYSIWYG settings'
type: module
core_version_requirement: ^10.3 || ^11
version: 9.8.6
version: 9.8.7
package: Stanford
2 changes: 1 addition & 1 deletion stanford_profile_helper.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type: module
description: 'Stanford Profile Helper Module.'
core_version_requirement: ^10.3 || ^11
package: Stanford
version: 9.8.6
version: 9.8.7
dependencies:
- admin_toolbar:admin_toolbar
- admin_toolbar:admin_toolbar_tools
Expand Down

0 comments on commit 17d7b8b

Please sign in to comment.