Skip to content

Commit

Permalink
Split article css into separate libs
Browse files Browse the repository at this point in the history
* initial

* align with changes in 6.5.x

* fix

* revert file

* fix cs

* fix stan

* remove groups on gallery para preview

* trigger
  • Loading branch information
ol0lll committed Mar 6, 2023
1 parent f290495 commit 4ae7a47
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,7 @@ dependencies:
- media.type.gallery
module:
- empty_fields
- field_group
- media
third_party_settings:
field_group:
group_left:
children:
- field_media_images
label: Left
parent_name: ''
region: content
weight: 0
format_type: html_element
format_settings:
classes: group-left
show_empty_fields: false
id: ''
element: div
show_label: false
label_element: h3
label_element_classes: ''
attributes: ''
effect: none
speed: fast
group_right:
children:
- name
label: Right
parent_name: ''
region: content
weight: 1
format_type: html_element
format_settings:
classes: group-right
show_empty_fields: false
id: ''
element: div
show_label: false
label_element: h3
label_element_classes: ''
attributes: ''
effect: none
speed: fast
id: media.gallery.paragraph_preview
targetEntityType: media
bundle: gallery
Expand Down
41 changes: 0 additions & 41 deletions config/update/thunder_post_update_0001_upgrade_to_thunder7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -711,47 +711,6 @@ core.entity_view_display.media.gallery.paragraph_preview:
name:
weight: 1
update_actions:
add:
third_party_settings:
field_group:
group_left:
children:
- field_media_images
format_settings:
attributes: ''
classes: group-left
effect: none
element: div
id: ''
label_element: h3
label_element_classes: ''
show_empty_fields: false
show_label: false
speed: fast
format_type: html_element
label: Left
parent_name: ''
region: content
weight: 0
group_right:
children:
- name
format_settings:
attributes: ''
classes: group-right
effect: none
element: div
id: ''
label_element: h3
label_element_classes: ''
show_empty_fields: false
show_label: false
speed: fast
format_type: html_element
label: Right
parent_name: ''
region: content
weight: 1
change:
content:
field_media_images:
Expand Down
56 changes: 0 additions & 56 deletions modules/thunder_article/css/article-form.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,59 +32,3 @@
.content-form__form-section.article-teaser .field--name-field-teaser-media .media-library-selection .media-library-item--grid {
width: 100%;
}

/* Paragraphs section */

.field--name-field-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead {
display: none;
}

.paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead {
display: none;
}

.paragraph-type--text .paragraphs-subform .field--name-field-text label,
.paragraph-type--quote .paragraphs-subform .field--name-field-text label {
display: none;
}
.paragraph-type--link .paragraphs-subform .field--name-field-link,
.paragraph-type--text .paragraphs-subform .field--name-field-text,
.paragraph-type--quote .paragraphs-subform .field--name-field-text {
margin-top: var(--space-l);
}

/* Reset media and ief widget fieldsets. */

.field--widget-inline-entity-form-simple > fieldset .fieldset__legend,
fieldset.media-library-widget .fieldset__legend,
fieldset.media-library-widget .help-icon__description-toggle {
display: none;
}

.field--widget-inline-entity-form-simple > fieldset .fieldset__wrapper,
fieldset.media-library-widget .fieldset__wrapper {
margin: 0;
}

.field--widget-inline-entity-form-simple > fieldset,
fieldset.media-library-widget {
border: none;
padding: 0;
margin-bottom: 0;
margin-top: 0;
}

/* Hide empty text */
fieldset.media-library-widget .media-library-widget-empty-text {
display: none;
}

fieldset.media-library-widget .fieldset__suffix {
display: flex;
}

fieldset.media-library-widget .fieldset__suffix input,
fieldset.media-library-widget .fieldset__suffix .dropbutton-wrapper {
margin-bottom: 0;
margin-top: 0;
}
3 changes: 3 additions & 0 deletions modules/thunder_media/css/gallery.paragraph_preview.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
.media--type-gallery.media--view-mode-paragraph-preview .field__items img {
display: block;
}
.media--type-gallery.media--view-mode-paragraph-preview {
display: block;
}
34 changes: 34 additions & 0 deletions modules/thunder_media/css/media_library.widget.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* Reset media and ief widget fieldsets. */
.field--widget-inline-entity-form-simple > fieldset .fieldset__legend,
fieldset.media-library-widget .fieldset__legend,
fieldset.media-library-widget .help-icon__description-toggle {
display: none;
}

.field--widget-inline-entity-form-simple > fieldset .fieldset__wrapper,
fieldset.media-library-widget .fieldset__wrapper {
margin: 0;
}

.field--widget-inline-entity-form-simple > fieldset,
fieldset.media-library-widget {
border: none;
padding: 0;
margin-bottom: 0;
margin-top: 0;
}

/* Hide empty text */
fieldset.media-library-widget .media-library-widget-empty-text {
display: none;
}

fieldset.media-library-widget .fieldset__suffix {
display: flex;
}

fieldset.media-library-widget .fieldset__suffix input,
fieldset.media-library-widget .fieldset__suffix .dropbutton-wrapper {
margin-bottom: 0;
margin-top: 0;
}
5 changes: 5 additions & 0 deletions modules/thunder_media/thunder_media.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ gallery.paragraph_preview:
css:
theme:
css/gallery.paragraph_preview.css: {}

media_library.widget:
css:
theme:
css/media_library.widget.css: {}
10 changes: 9 additions & 1 deletion modules/thunder_media/thunder_media.module
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function thunder_media_page_attachments(array &$page): void {
}

/**
* Implements hook_field_widget_single_element_WIDGET_ID_form_alter().
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter().
*
* Add process function to hide 'remove' button of image field widget on inline
* entity forms.
Expand Down Expand Up @@ -61,6 +61,14 @@ function thunder_media_field_widget_single_element_image_focal_point_form_alter(
}
}

/**
* Implements hook_field_widget_complete_WIDGET_TYPE_form_alter().
*/
function thunder_media_field_widget_complete_media_library_media_modify_widget_form_alter(array &$field_widget_complete_form, FormStateInterface $form_state, array $context): void {
// Add custom styling.
$field_widget_complete_form['#attached']['library'][] = 'thunder_media/media_library.widget';
}

/**
* Process function to hide 'Remove' button on image widget forms.
*/
Expand Down
19 changes: 18 additions & 1 deletion modules/thunder_paragraphs/css/paragraphs.widget.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
/* Subform */

/* Remove details summary and type info, */
/* Remove paragraphs table header. */
.field--name-field-paragraphs .paragraphs-tabs-wrapper table.field-multiple-table:first-of-type thead {
display: none;
}
.paragraph-type--link .paragraphs-subform .field--name-field-link table.field-multiple-table:first-of-type thead {
display: none;
}
.paragraph-type--text .paragraphs-subform .field--name-field-text label,
.paragraph-type--quote .paragraphs-subform .field--name-field-text label {
display: none;
}
.paragraph-type--link .paragraphs-subform .field--name-field-link,
.paragraph-type--text .paragraphs-subform .field--name-field-text,
.paragraph-type--quote .paragraphs-subform .field--name-field-text {
margin-top: var(--space-l);
}
/* Remove details summary and type info. */
.paragraph-form-item--has-subform .field--name-field-video > details[open] > summary,
.paragraph-form-item--has-subform .field--name-field-image > details[open] > summary,
.paragraph-form-item--has-subform .field--name-field-media-images > details[open] > summary,
Expand All @@ -27,3 +43,4 @@
.media--view-mode-paragraph-preview .group-right {
flex: 1 1 auto;
}

8 changes: 4 additions & 4 deletions modules/thunder_paragraphs/thunder_paragraphs.module
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ function thunder_paragraphs_field_widget_third_party_settings_form(WidgetInterfa
}

/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter().
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter().
*
* Used for Classic Paragraphs widget.
*/
function thunder_paragraphs_field_widget_entity_reference_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void {
function thunder_paragraphs_field_widgett_single_element_entity_reference_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void {
thunder_paragraphs__attach_ief_submit(
$element,
[
Expand All @@ -43,11 +43,11 @@ function thunder_paragraphs_field_widget_entity_reference_paragraphs_form_alter(
}

/**
* Implements hook_field_widget_WIDGET_TYPE_form_alter().
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter().
*
* Used for Experimental Paragraphs widget.
*/
function thunder_paragraphs_field_widget_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void {
function thunder_paragraphs_field_widget_single_element_paragraphs_form_alter(array &$element, FormStateInterface $form_state, array $context): void {
// Based on logic in ParagraphsWidget::formMultipleElements - execution of
// alter hook for existing paragraphs will be executed first and only with
// list of editable paragraphs. Since all editable paragraphs are processed
Expand Down

0 comments on commit 4ae7a47

Please sign in to comment.