gewagner
Forum Replies Created
-
Hi Hardeep.
I created a draft pull request that references two files in my github repository. Both contain changes to how padding and margins are handled based on the data that was created by Otter Blocks since December 01, 2021. Both also log messages for purposes of understanding the data.
Since git and github were only gaining traction right before I retired, my knowledge of both is limited.
Should you have any problems accessing these two files, please let me know.
I am concerned about any solution that is not backwards compatible. The data that determines the setting of padding and margins is not always consistent so simple if/else statements like those found in class-advanced-column-css.php and class-advanced-columns-css.php will not suffice no matter what happens on the JS side.
I have code that replaces the current if/else statements with other more complex if/else statements that account for every data condition I have encountered on a fairly complex page.
If you would like a copy of that code, which includes diagnostic logging, just let me know how to share it with you.
Hi Hardeep,
The fixes necessary are in class-advanced-column-css.php and class-advanced-columns-css.php.
Both classes have a function named merge_old_attributes. In that function there is an attempt to set the padding as well as an attempt to set the margins using simple if/else statements (in both cases).
Neither attempt satisfies all of the possible (data) conditions. I have some crude code that fixes most of the problems, but I need to refine it further before sharing it.
When I run my code the values for both padding and margins can be seen in the block editor and are now correct (except for a few odd conditions I am working on).
I hope this helps and I will share more as soon as possible.
Thanks for your help. There is no need to look into this further since I rewrote the “html block” so that it no longer relies on Otter Blocks. As I see it, Otter Blocks will not visit any “html block” when parsing. It only looks for “themeisle” blocks.
If I insert an “icon block” before my code, all of the CSS is enqueued and my code works.
If I remove that “icon block, the CSS is not enqueued. Please keep in mind the fact that my code is within an “html block” that is highly customized to meet my needs.
A copy of my “html block” follows. If you have time to analyze why otter blocks 2.0.1 will not parse this code, please let me know. Thanks in advance.
<p class=”wp-block-themeisle-blocks-font-awesome-icons has-nv-site-bg-color has-text-color” id=”hcpt-get-directions” style=”font-size: 1.5em; padding: 2px 2px 2px; margin: 10px 0px 10px; text-align: center;”>
<span class=”wp-block-themeisle-blocks-font-awesome-icons-container” style=”vertical-align: middle; padding: 5px 10px 5px; background: var(–nv-primary-accent); border: 1px solid #ffffff;”>
<span style=”color: var(–nv-site-bg); float: left !important; padding-right: 10px;”>
<i class=”far fa-map”></i>
</span>
<span style=”float: right !important; text-decoration: none; color: var(–nv-site-bg);”> Get Directions</span>
</span>
</p>Based on my testing, I agree that the CSS is only enqueued if the block is used on the page. Unfortunately, if the block is used inside a reusable block on the page, the CSS is not enqueued. Any thoughts?