Closed (fixed)
Project:
ZURB Foundation
Version:
8.x-6.x-dev
Component:
User interface
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
24 Jan 2016 at 17:45 UTC
Updated:
3 Jan 2020 at 16:04 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
oscarvargas102 commentedComment #3
dabito commented@oscarvargas102 Patch does not comply with Drupal coding standards, please correct!
Comment #4
samuel.mortensonThe patch also does not do what @tkoleary original suggested.
Comment #5
oscarvargas102 commentedDrupal coding standars fixed
Comment #6
samuel.mortensonMoving to Needs work, the patches so far are unrelated to the original issue. If you would like a configurable copyright block, you can always create a custom block and place it in the footer region (once this issue is Fixed).
Comment #7
dabito commented@samuel.mortenson removing hard-coded copyright from twig is easy, adding a custom block with content via YML has proven a bit of a challenge.
Does anybody have any pointers as to how this could be achieved?
So far, I've tested the following block.block.zurb_foundation_copyright.yml in /config/install with the following contents:
The block gets created and assigned to the correct theme/region
, but every other block is cleared upon install and so far I can't figure out how to add block_content only using YMLs...@tkoleary did you see this working somewhere else we could use as an example?
Thanks!
Comment #8
samuel.mortensonYou cannot create Content Blocks in .yml files, as they're Content Entities. I'll wait to hear @tkoleary's opinion about the patches so far before proceeding.
Comment #9
tkoleary commented@samuel.mortenson
It is not necessary that it be a "content block." In fact, what it should be is a block generated by a module that provides configuration options, like a text field stored as a string for the copyright holder's name perhaps prefixed with a select box for the user to chose between ©, TM, ®, etc. and a token that uses date to display the current year.
So the form could be:
Field label: Property name
Radios: Site Name, Site URL, Custom (opens text field), None
Field label: Prefix
Select opts: ©, TM, ®
Field label: Date
Radios: Current Year, Custom Date (opens date widget), None
Field label: Intellectual property owner's name
Text field
Field label: Suffix:
Text field
Which could produce any of the following:
This would then be something useful in several different contexts as I might want to ® my logo and TM my products as well as © my whole site and get the benefit of having all dates automatically update.
Comment #10
kevinquillen commentedI'm all for an interim commit that removes the hard coded values, a change we should strive for.
As for providing a block out of the box for this specific need, I am on the fence about. If it whittles down to just a block, I feel like most people are going to want full control of it anyway, and providing regions seems to be enough to me to grant that ability.
Comment #11
nickbumgarner commentedI would probably side with Kevin on this issue. At this point you're just asking to ship editable content out of the box.
Comment #12
samuel.mortensonPutting this back into review, if anyone would like to RTBC the most recent patch I would be willing to commit it to 8.x-6.x. @tkoleary's notes about a module-provided configurable copyright block would have to be addressed in a new project.
Comment #13
hongpong commentedI rerolled the patch against 1a6cffb5dc95516a502f7cf28c77d9bef90d1004 by hand, and tested it in Drupal 8.0.6 standard install. it saves the Copyright settings correctly & I believe it is RTBC.
Comment #14
samuel.mortensonA few nitpicks/changes:
No default value for the custom text, and the naming scheme of the variable doesn't match anything else.
Checking for block_copyright here hid the normal copyright text unless a custom one was defined, which doesn't make sense. I removed this if statement and kept the normal if/else block.
Nitpick - I don't like double negatives in forms, and I would like the variable naming/form text here to match what we already have with custom back text.
Rendered the custom copyright text with #markup, which protects against XSS vulnerabilities. As far as I know rendering the raw text in twig would have allowed
<script>tags and the like.Comment #15
hongpong commentedThanks I was wondering about sanitization of the string, not yet familiar with the D8 way. This seems good to me although I don't know if it makes sense to render "bottom-bar panel" even when there is no string going on (in the second chunk of the interdiff). The earlier version had a broader if statement to prevent that rendering. Otherwise RTBC?
Comment #16
samuel.mortensonThis patch doesn't add an explicit way to remove the copyright - so we would have to do an if statement that checks if a custom copyright is used and that the custom copyright (string) is empty. I would consider conditionally rendering that a distinct setting, so we would need another setting saying something like "Hide copyright block". Someone could add that in this issue if it's needed or open a new issue after this is RTBC'd and committed.
Comment #17
hongpong commentedOkay I learned some interesting things in this process. Question: Is it okay to not sanitize the boolean into twig?
I think this has the toggle feature we are looking for, I tested it and it seems to work correctly, with no markup shown if everything is disabled. Please take it for a spin.
Comment #18
samuel.mortenson@HongPong Using variables in evaluations like
{% if block_copyright_show %}is totally fine, as long as you aren't actually printing them there shouldn't be a risk.Comment #19
serg2 commented@HongPong
I think we should pick this back up. If you re-roll I can review it.
Comment #20
sim_1I rerolled this by hand so I don't have a interdiff. This should apply to the latest 8.x-6.x dev branch.
I tested it on Drupal 8.7.7 and it appears to work correctly. Marking it as ready for review so someone else can test it as well.
Comment #21
taiger commentedI tested the copyrightblock-2655760-20.patch in #20 and it works fine.
It does make the copyright go full width now, which is a change, but this seems fine as is. It removes two less unnecessary divs in page.html.twig:
Comment #23
hongpong commentedThank you sim_1 and Taiger for revisiting and testing this. I think for now this is a good improvement. Wow that took quite a few years!