Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #3913 Add new content field to AZ Publication. #3914

Merged
merged 33 commits into from
Feb 19, 2025

Conversation

trackleft
Copy link
Member

@trackleft trackleft commented Nov 26, 2024

Description

This Pull Request adds a new field and some demo content for the az_publication content type.
The new field has been added as hidden on each existing display mode except for the default display.
The new field has been added to the bottom of the az_publication edit/create form

Related issues

Close #3913

How to test

Create a new publication
Scroll to bottom of publication form and see field labelled page elements.
Add some elements and save the publication.
View how the publication is displayed.

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
    • Adding experimental module
    • Update experimental module
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Upgrade experimental module to stable
    • Enable existing module by default or database update
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown
    • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown
    • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown
    • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires release notes.

@trackleft trackleft requested a review from a team as a code owner November 26, 2024 21:55
@trackleft trackleft added patch release Issues to be included in the next patch release publications labels Nov 26, 2024
@trackleft
Copy link
Member Author

It was determined that we should include the new content field as a paragraphs field.

ewlyman
ewlyman previously approved these changes Jan 10, 2025
Copy link
Contributor

@ewlyman ewlyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field works as designed. All good as far as I can see :)

@trackleft
Copy link
Member Author

Add paragraphs as a dependency of az_publication.

@trackleft
Copy link
Member Author

trackleft commented Jan 10, 2025

@bberndt-uaz
Copy link
Contributor

image

For the default display (as shown above), I recommend that we add headings for the Publication File and the Main Content. Also, maybe the Publication File should go directly below the Reference?

@bberndt-uaz
Copy link
Contributor

bberndt-uaz commented Jan 17, 2025

To follow up on a question that came up on Wednesday about the heading text for the main content field: it seems difficult to come up with an appropriate heading that would account for all situations. I think we could make the heading customizable as Cameron suggested as an option or we could skip adding the heading and just add a small amount of extra margin above that field to set it apart from the other content. I still think the Publication File should have a heading or some kind of label--whatever you think is best!

bberndt-uaz
bberndt-uaz previously approved these changes Jan 23, 2025
Copy link
Contributor

@bberndt-uaz bberndt-uaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

image

@trackleft
Copy link
Member Author

trackleft commented Jan 24, 2025

Use full text for the label instead of publication.

@tadean
Copy link
Contributor

tadean commented Feb 5, 2025

I can't provide a commit suggestion because the file's not in the PR, but perhaps something like the following?

diff --git a/modules/custom/az_publication/az_publication.module b/modules/custom/az_publication/az_publication.module
index 2ba7ad9b..905dbadb 100644
--- a/modules/custom/az_publication/az_publication.module
+++ b/modules/custom/az_publication/az_publication.module
@@ -275,9 +275,14 @@ function az_publication_node_view(array &$build, EntityInterface $entity, Entity
           if ($view_mode !== 'full') {
             $has_cover = !empty($entity->field_az_publication_image->target_id);
             $has_abstract = !empty($entity->field_az_publication_abstract->value);
+            // Check if publication has paragraph content.
+            $has_content = (
+              $entity->hasField('field_az_main_content') &&
+              !empty($entity->get('field_az_main_content')->referencedEntities())
+            );
             $url = Url::fromRoute('entity.node.canonical', ['node' => $entity->id()]);
-            // Linking to full node if there is an abstract or cover page.
-            if ($has_cover || $has_abstract) {
+            // Link to full node if there is abstract, cover page, or content.
+            if ($has_cover || $has_abstract || $has_content) {
               $blob->itemlink = $url->toString();
             }
           }

@trackleft
Copy link
Member Author

While writing tests for this, I found a potential bug where non-links are rendered within a tags.
Screenshot 2025-02-06 at 10 30 44 AM

@trackleft
Copy link
Member Author

Markup for row that has failing test

<div class="views-row">
    

<article class="node node--type-az-publication node--view-mode-az-publication-reference clearfix">
  <header>
    
        
      </header>
  <div class="node__content clearfix">
    <div class="csl-bib-body">
  <div class="csl-entry"><a href="/person/thomas-urquhart">Sir Thomas Urquhart</a>. “<a href="/sites/default/files/Small-PDF.pdf" class="ext" data-extlink="" target="_blank" rel="noopener" title="(opens in a new window)">The Trissotetras: Or, a Most Exquisite Table for Resolving All Manner of triangles. </a>”. <i>Book</i>, 2nd Edition, Mathematical Works Publishing, 15 Jan. 2023, p. 400, <a href="https://doi.org/10.1000/2000">https://doi.org/10.1000/2000</a>. <a href="https://example.com/trissotetras">https://example.com/trissotetras</a></div>
</div>
  </div>
</article>

  </div>

@bberndt-uaz
Copy link
Contributor

On the default display, is the Cover Link necessary? If not, I would recommend removing it to prevent the caption and image credit of the publication image from being wrapped in links to the publication file.

image

@tadean
Copy link
Contributor

tadean commented Feb 11, 2025

On the default display, is the Cover Link necessary? If not, I would recommend removing it to prevent the caption and image credit of the publication image from being wrapped in links to the publication file.

The use-case for this particular feature is in the case where the cover image is sometimes a screenshot of the journal or publication itself, where it might be somewhat natural for the user to click on the picture of the publication to see it.

It does seem somewhat unfortunate styling when combined with image credits, however... maybe we should consider whether the publication file link from the image is useful enough to warrant the confusing styling of caption/credit.

tadean
tadean previously approved these changes Feb 12, 2025
@tadean
Copy link
Contributor

tadean commented Feb 12, 2025

Should az_publication now declare a dependency on az_paragraphs ?

@trackleft
Copy link
Member Author

@maine-inventor
Copy link
Contributor

Works. Added a publication of a certain type, issue, volume, version. The citation displays correctly.

Copy link
Contributor

@maine-inventor maine-inventor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works. Added a publication of a certain type, issue, volume, version. The citation displays correctly.

@joeparsons joeparsons changed the title Close #3913 Add new content field to publication. Close #3913 Add new content field to AZ Publication. Feb 19, 2025
@joeparsons joeparsons added 2.13.x only enhancement New feature or request and removed patch release Issues to be included in the next patch release labels Feb 19, 2025
@joeparsons joeparsons merged commit b751c72 into main Feb 19, 2025
16 checks passed
@joeparsons joeparsons deleted the issue/3913-add-content-field-to-az-publication branch February 19, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a content field to publication in order to allow hosting a journal.
6 participants