Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Spamicide use css file stored in public://spamicide to hide spamicide field in forms.
I have an issue, my css file and spamicide directory wasn't created (my files and directories rights are good for writing). I think this issue comes from fact that i never submit spamicide admin page. But it's not the main case of my issue.
So reading module code, i don't understand interest using css file and not just inline css drupal_add_css($css, 'inline'). Using inline css, we don't have file existing tests anymore and no writing issues.
I'll post patch soon
Comment | File | Size | Author |
---|---|---|---|
#2 | spamicide-use-inline-css-attached-1916964-2.patch | 10.86 KB | GoZ |
Comments
Comment #1
lipcpro CreditAttribution: lipcpro commentedInline css is not best practices. There must be something else that is the problem.
Comment #2
GoZ CreditAttribution: GoZ commentedDo you have a source which explain inline css is not best practice ?
It's best practice when you have a lot of css properties to add.
Since you have only one dynamique line (with variable $form_field), your trick is to generate multiple files, one by field. With this trick, we have multiple css files, multiple files existing tests and you have to deal with create and delete files (heavy).
More than inline or file css question, css is added with drupal_add_css on form_alter. Best practice is to add css with #attached form property http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht....
This patch is part of the #1day1patch initiative.
Comment #3
GoZ CreditAttribution: GoZ commentedbot needs review
Comment #4
lipcpro CreditAttribution: lipcpro commented"Best practice is to add css with #attached form property http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.ht...."
I do add css in this fashion, which is NOT inline. If you could find out why the module can't create the spamicide directory that would solve your problem. Are you using a private file system?
Comment #5
GoZ CreditAttribution: GoZ commentedI think files are not generated because i have no spamicide directory in files directory (a drupal build thanks to a database backup and drupal files without sites/default/files). Since i don't launch .install on my instance, i guess spamicide directory never been created.
I don't understand why inline css is not an option while this is lighter than dealing with files.
Comment #6
lipcpro CreditAttribution: lipcpro commented