This module provides a solution to use newer HTML5 elements as wrappers for blocks. This gives site builders the ability to chose the element to apply to a block rather than rely on the hard coded element in the block template. This does this by providing a $tag variable to use in block.tpl. If no element has been selected it will default to div.
I was unable to find a module which also does this. The previous method would be manually creating various block templates or adding the elements prior to block rendering in the page template. This creates code bloat as you still have the div for the block.
Sandbox : http://drupal.org/sandbox/ericgsmith/1421838
Git repo: http://git.drupal.org/sandbox/ericgsmith/1421838.git 7.x-1.x
This module is for drupal 7.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Screen Shot 2012-02-02 at 7.08.47 PM.png | 38.47 KB | alex dicianu |
| #6 | Screen Shot 2012-02-02 at 7.10.13 PM.png | 156.87 KB | alex dicianu |
Comments
Comment #1
drupaledmonk commentedIt appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:
Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards). See attachment.
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
Source: http://ventral.org/pareview - PAReview.sh online service
Comment #2
drupaledmonk commentedComment #3
ericgsmith commentedThank you for that,
I have created a new branch and have fixed those errors. I have also added hook_help into the module.
http://git.drupal.org/sandbox/ericgsmith/1421838.git 7.x-1.x-dev
Cheers,
Eric
Comment #4
patrickd commentedFYI
with a branched called "7.x-1.x-dev" you'll not be able to create a release later, it has to be 7.x-1.x for that (see naming conventions http://drupal.org/node/1015226) surely you can create this branch later, but it would be better if you'd follow the conventions to avoid confusion
Comment #5
ericgsmith commentedThank you, I had overlooked that. Added branch 7.x-1.x and removed incorrectly named branch. New git repo:
http://git.drupal.org/sandbox/ericgsmith/1421838.git 7.x-1.x
Comment #6
alex dicianu commentedHi,
I looked over your module and saw that on the block configuration page, your config is the first one, above the title. I think you should move it down a bit.
Looking into the code, line #65, you have a function named
I'm not sure if it's a good idea to have a function with the same name as the module itself. You should probably change it to something like
I don't know if it's a bug or I have some other stuff to configure, but for the development block I chose the
asidetag and I didn't saw it on page. See screenshots attached.Comment #7
ericgsmith commentedThanks dicix, did you read the install instructions re changing the block tpl?
I haven't used theme registry alter as a lot of modules and themes have custom block templates. This module outputs a $tag string to the template so if you are using a custom template you will need to replace div with $tag, or if you are not simply copy the tpl file to the theme folder.
I could provide the option to use theme registry alter but this could possibly conflict with users themes.
Comment #8
ericgsmith commentedI have updated the module to include a configuration page where you can choose to have the module override the template or to do it yourself. Appropriate changes to readme have been made.
Comment #9
ericgsmith commentedAdjusted priority in accordance with the application review timelines http://drupal.org/node/539608
Comment #10
ericgsmith commentedAdjusted priority in accordance with the application review timelines http://drupal.org/node/539608 - 4 weeks since last comment from reviewer.
Comment #11
patrickd commentedcould you get it managed to write more information on your project page? ;-)
'#description' => $description,doing this is also not necessary if the description is only used once!
I actually wanted to do this more intensive, but I'm getting tired :/
As I only found some minor stuff, I won't switch to needs work and have another look tomorrow.
Generally I'm sorry for the delay!
as there are currently many applications in queue we need more reviewers,
so think about getting a review bonus and we will come back to your application sooner.
regards
Comment #12
ericgsmith commentedHi Patrick,
Thank you for having a look - I appreciate that there are a lot of other projects waiting.
I have made changes noted above, can you please cofirm that by "put your .gitignore into your .gitignore" I am simply telling git to ignore the ignore file? If so I have done this no as well.
Thanks,
Eric
Comment #13
patrickd commentedyes, putting the gitignore into the gitignore make git ignore the gitignore :D
Comment #14
patrickd commentedsoo let's get picky
(many of these points are suggestions, don't follow them blind, feel free to ask)
you indented here with 1 space too much
Unfortunately it's not easy to use the more performat hook_form_FORM_ID_alter here because you have to react on 2 form-id's.. but anyway you should only check whether the user has access if you're sure you got the right id to work with.
why are you translating html-tags?
if you really want to do that you should at least do it this way:
So the tags are only translated for displaying them in the select box but not when including them into the template
maybe it would be better to use
semantic_blocks_get_element($module, $delta)instead of working around of it?semantic_blocks_form_alterandsemantic_blocks_form_submitare very general.. maybe you could choose a more obvious name for them ? (As they have a very specific function)same access stuff here, I don't think it's necessary to check again after submit. (this would all become easier if you use administer blocks instead)
I see indenting issues in several places - where you break lines - you should indent
do never ever use t() in hook_menu - seriously! ;)
variable_get('semantic_blocks_override_template', 0),if you're using variables - delete them in your install file with hook_uninstall and variable_delCoding standarts say you don't have to break code in variable definitions when it's getting ugly!
all comments should and with . / ! / ?
you don't have to document the returning value - if you're just saying it's a "Drupal form" ;)
if (variable_get('semantic_blocks_override_template') == 1) {When using booleans you should always use TRUE or FALSEthat's it! phew!
Comment #15
ericgsmith commentedHi Patrick,
Thank you for the review. I have made changed for almost all of the above, just a few questions / comments below.
I thought that hooks had to be named [modulename]_[hook] ?
Re the access - as a control freak I prefer to limit what content editors can do, and often would want them to be able to modified the content and location of block without needing to understand HTML - and thus would prefer to hide the element selector from them as they don't need it. This module is more for site builders who ideally would be setting up blocks whose semantic information won't change, i.e. setting nav on the main menu block. This is something I think a lot of people may find useful which is why I added the permissions.
Thanks,
Eric
Comment #16
patrickd commentedOh, you're right with the function names .. (seems like I was very tired yesterday^^) - forget this one
Me personally would rather see less permissions, but okay if you're sure it's needed - why not
A few points I recognized while having a quick look
As you only add your submit handler when you already made sure it's a block add/edit form you don't have to check whether it's the right form again in your submit handler - in other cases it would never be called (I'm not sure if drupal detects and uses this submit handler automatically because it has the same name as the hook_form_alter with _submit - you should test this - if it's the case you should rename the submit handler)
variable_get('semantic_blocks_override_template', 0),Also here's a boolean - use FALSE !I don't tested the functionality again, I think it should work..
Please fix those issues mentioned above, but anyway I think this is ready..
Please concider to get a review bonus and we will come back to your application sooner!
I'm changing the priority back to normal - you can raise it again if you (hopefully not) waited for another 2 weeks.
regards
Comment #17
ericgsmith commentedI think I do need to check the block ID here again as hook_form_submit will be called on all form_submits.
.gitignore seems to be ignored now and have updated that last error.
Thank you for your efforts with this review.
Eric
Comment #18
patrickd commentedthere is no hook_form_submit, that's the reason why you should rename it.
In the hook_form_alter you add your custom submit handler only if you already verified you're handling the right form
-> the submit handler should only be called when it's added as submit handler
-> if it's called anyway you should rename it to eg. _block_form_submit() so it'll be definitely only called when you added it
that's what I meant in #16 (sorry it's kind of hard to explain that ^^)
regards
Comment #19
ericgsmith commentedAh I see that makes sense. I have change the function name to be clearer and have removed the unneeded check. Your answer made sense it's just been a while since I'd written this so had slipped my mind how the function was being called. Cheers, Eric.
Comment #20
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
manual review:
Comment #21
ericgsmith commentedHi klausi,
Thank you I have made those changes.
Just a quick question, why did I need to change db_insert to drupal_write_record? Like I assume a lot of people do I learn from example and documentation, e.g. http://drupal.org/node/310079 which doesn't mention drupal_write_record.
I appreciate the review and that there are a lot of them, but it would be very helpful to not just be told what is wrong / not best practice, but why it is wrong.
Thanks,
Eric
Comment #22
ericgsmith commentedAdjusted priority in accordance with the application review timelines http://drupal.org/node/539608
Comment #23
ericgsmith commentedAdjusted priority again.
Comment #24
scot.hubbard commentedHi Eric,
I have just completed reviewing your module and it would appear that most, if not all, of the points above have been addressed.
There are no licensing issues with the code as no third party files are included.
An automated review did not find any issues, and on a closer manual inspection I found the following:
Your hook_menu() function specifies the admin path as:
$items['admin/config/development/semantic_blocks'] = array(and you refer to this path in your .info file, as per:
configure = admin/config/development/semantic-blocksThis does not actually work as there is a mismatch between the two - you have used an underscore in hook_menu() and a hyphen in the configure link in .info. Personally I would update the hook_menu() path to use a hyphen, as that seems to be the norm in Drupal.
Assuming that is fixed, which I am sure it will be ;-) I see no reason to go RTBC with this module.
Comment #25
klausidrupal_write_record() validates against the schema of the table and has some sanity checks built in, so you can consider it more safe than a raw db_insert(). Sorry for not mentioning that.
Thanks for your contribution, ericgsmith! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.
Thanks to the dedicated reviewer(s) as well.
Comment #26
ericgsmith commented:D Thank you all very much for the review guys. I look forward to contributing more to the Drupal community and will definitely try and help out in the application queue in future.
Once again big thanks,
Eric
Comment #27.0
(not verified) commentedUpdated git location