Skip to content

Commit

Permalink
CTA Changes #422 (#457)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Rasmussen <ericrasmussen1@gmail.com>
  • Loading branch information
sarongebre and ericras authored Jun 20, 2023
1 parent cfaa0da commit 25ca4d5
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
third_party_settings:
allowed_formats:
allowed_formats:
- block_body
- minimal
_core:
default_config_hash: nbZQ0zuHR-G4d9u6zBOwktlVA9OjIrERCiF3V_mBQLc
id: block_content.cta.b_cta_summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
third_party_settings:
allowed_formats:
allowed_formats:
- block_body
- minimal
id: block_content.cta.b_cta_summary
field_name: b_cta_summary
entity_type: block_content
Expand Down
28 changes: 13 additions & 15 deletions web/themes/custom/unl_five_herbie/css/theme/block/cta.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

/* This file might not be needed consult with Ryan/Eric on Monday*/
/* h2, p, */
/* :nth-child() */

/* This won't work because it applies it to every block, if the section background is scarlet */

/* div.unl-bg-scarlet div.unl-bg-scarlet h2, div.unl-bg-scarlet div.unl-bg-scarlet p{
color: rgb(0, 112, 211);
} */

/* div.unl-bg-scarlet div.unl-bg-scarlet h2, div.unl-bg-scarlet div.unl-bg-scarlet p{
color: rgb(5, 0, 255);
} */

.unlcms-cta-link-width {
min-width: 75%;
}

/* dcf-mb-0 */
.unlcms-cta-title h2 {
margin-bottom: 0 !important;
}

/* dcf-w-max-lg */
.unlcms_cta_summary {
max-width: 42.0923889211rem !important;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ attach_library('unl_five_herbie/cta') }}
{% set attributes = attributes ?: create_attribute() %}
{% set card_classes = ['dcf-col-100%', 'dcf-grid-thirds@md', 'dcf-col-gap-6', 'dcf-row-gap-3', 'dcf-p-6'] %}
{{ attach_library('unl_five_herbie/cta') }}
Expand All @@ -6,14 +7,16 @@
{{ title_prefix }}
{{ title_suffix }}
{% block cta_title %}
<div class="dcf-d-flex dcf-ai-center dcf-jc-center dcf-uppercase">
<div class="unlcms-cta-title dcf-d-flex dcf-ai-center dcf-jc-center dcf-uppercase">
{{ content.b_cta_title }}
</div>
{% endblock %}

{% block cta_summary %}
<div class="dcf-d-flex dcf-ai-center dcf-jc-center dcf-pt-2 dcf-pb-2 dcf-txt-center">
{{ content.b_cta_summary }}
<div class='unlcms_cta_summary'>
{{ content.b_cta_summary }}
</div>
</div>
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*/
#}

{% for item in items %}
{{ item.content }}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*/
#}

{% for item in items %}
{{ item.content }}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*/
#}

{% for item in items %}
{{ item.content }}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ cta:
theme:
css/theme/block/cta.css: {}


8 changes: 4 additions & 4 deletions web/themes/custom/unl_five_herbie/unl_five_herbie.theme
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ function unl_five_herbie_preprocess_field(&$variables) {
$ctaFields = array('b_cta_link', 'b_cta_summary', 'b_cta_title');

if (in_array($field_name, $ctaFields)) {
$block_background = $variables['element']['#object']->__get('#block_lbs');
$block_background = $variables['element']['#object']->__get('#block_lbs');
switch ($field_name) {
case 'b_cta_link':
foreach ($variables['items'] as $key => $item) {
if(in_array("block_background_style_brand", $block_background) ||in_array("block_background_style_dark", $block_background) ) {
$variables['items'][$key]['content']['#options']['attributes']['class'][] = 'dcf-btn dcf-btn-inverse-primary dcf-uppercase';
}
else {
$variables['items'][$key]['content']['#options']['attributes']['class'][] = 'dcf-btn dcf-btn-primary dcf-uppercase';
$variables['items'][$key]['content']['#options']['attributes']['class'][] = 'dcf-btn dcf-btn-inverse-primary dcf-uppercase dcf-d-block unlcms-cta-link-width';
} else {
$variables['items'][$key]['content']['#options']['attributes']['class'][] = 'dcf-btn dcf-btn-primary dcf-uppercase dcf-d-block unlcms-cta-link-width';
}
}
break;
Expand Down

0 comments on commit 25ca4d5

Please sign in to comment.