unlcms / project-herbie

Drupal 10 implementation at the University of Nebraska–Lincoln
https://cms.unl.edu
GNU General Public License v2.0
5 stars 6 forks source link

Hero custom block #67

Closed ericras closed 4 years ago

ericras commented 4 years ago

The hero region exists in the page template and the fields need to "lifted" up to that level with code.

I'm thinking about:

Alternatives:

ericras commented 4 years ago

And I think we want the photo used within the hero to appear in the hero's teaser view

macburgee1 commented 4 years ago

My vote is a custom block type. IEF would be a good idea to help keep the UI sane.

ericras commented 4 years ago

Complex widget:

Screen Shot 2019-06-24 at 4 23 38 PM

It looks like with IEF we need to use the complex widget even though we probably don't want to allow existing heroes to be referenced. The simple IEF widget requires the Block Description to be filled out and would create a (sometimes empty) hero for every node.

Simple widget:

Screen Shot 2019-06-24 at 4 26 02 PM
ericras commented 4 years ago

Actually, the "Block description" can be hidden on "manage form display".... but then the custom block list has a blank space for it. We probably want to hide the "Block description" but auto populate it on save with a default value like: "Hero for node 84".

Edit: this is not included in this PR. For now, it is blank. See https://github.com/unlcms/project-herbie/issues/86 for follow-up issue.

ericras commented 4 years ago

https://github.com/unlcms/unl_five/pull/12

ericras commented 4 years ago

Dependent on #44

ericras commented 4 years ago

This PR:

macburgee1 commented 4 years ago

When I add a hero to a Builder Page, nothing prints in the Hero region and the hero block prints inside the Content region.

Expected:

Expected

Actual:

Actual

This is on a fresh install

ericras commented 4 years ago

I just did a fresh install and it doubles up for me. I'll work on it

Screen Shot 2019-07-03 at 4 09 18 PM
ericras commented 4 years ago

Last commit should fix the hero printing inside content. IDK why nothing is showing in your hero region. With my fresh install that wasn't an issue.

macburgee1 commented 4 years ago

Reference media entity or Image field upload

For images used in structured content (i.e. anywhere other than media embedded in a rich text field), I think should use image fields. When we use images in structured content, that content provides context that does not exist for embedded media. In the case of a hero image, we know the resolutions and ratio that will be used on display. As a result, we can enforce a minimum resolution at upload. We can also provide a preview using an appropriate image style. This is also true for images used in card blocks. The minimum upload resolution will be different from the one we use for hero images. This context doesn't exist for embedded media. On other projects, I've used this distinction, and it seems to click for users.

Image Styles

I'm fine deferring for now. We should investigate conditionally applying image styles based on the hero size.

Permissions

We need to grant the following permissions to Editors and Administrators:

The current behavior is that a user can create a Hero block with IEF but cannot edit it after it's been created.

Revisions

Currently, IEF does not support entity reference revisions. When a hero is updated, the reference is to the block entity, not a revision of the block entity. I'm not sure how important this is to us, but here's the issue on Drupal.org: Support entity revision references

Remove Revision log message field

What do you think about removing the Revision log message field?

revision log message

Add human-readable labels for Hero size select list

Can we add human-readable labels for the Hero size select list?

Hero size select list

For example, either "Large" or "Large (dcf-hero-lg)" in place of "dcf-hero-lg".

Auto-collapse Behavior

The auto-collapse behavior of IEF is a little aggressive. For example, if a user expands the details element and clicks on the 'Edit' button for an existing Hero block, then the edit form loads but the details element collapses immediately. This is something that needs fixed in IEF. We can spin that off to a separate issue, but I wanted to first document with this pull request.

ericras commented 4 years ago

Reference media entity or Image field upload -- needs discussion Image Styles -- #87 Permissions -- committed Revisions -- #117 Remove Revision log message field -- non-blocker, follow up in #116 Add human-readable labels for Hero size select list -- committed Auto-collapse Behavior -- committed

ericras commented 4 years ago

b_hero_media (media ent ref) has been converted to an image field (b_hero_image).

Ready for review

macburgee1 commented 4 years ago

Blocks #86