I would like to add 2 modules:
- node_block module - allows to add automatically block for new nodes for specific content type.
Details: in module settings we can define for which node type we want to add a block. We can also select how many blocks we want to add for every new node, define default title, and region for the block, select from allowed fields which we want to use as block content.
Blocks for specific node are visible only in node page.
How we are using this module. In one of our projects (for tourists) we have content type 'town' and we need to create for every node map (embed code from google maps). With node_block module we define field 'map' (textarea field type) where we can paste embed code. In module settings we defined auto block for content type 'town' and as a content of block we selected field 'map'. Now for new 'town' node type we need to only past the embed code and blocks are created automatically.
-signup_extra_fields module - this module is a extension of signup module. With this module we can define some extra fields to signup form and store values from fields together with existing signup field values.
In module settings we can define new field which will be shown in signup. We can choose field type, add title and description for field and select content type for which we want to display the field.
We think this modules can be useful also for other Drupal users that's why we want to add them to Drupal projects.
- node_block module - allows to add automatically block for new nodes for specific content type.
Details: in module settings we can define for which node type we want to add a block. We can also select how many blocks we want to add for every new node, define default title, and region for the block, select from allowed fields which we want to use as block content.
Blocks for specific node are visible only in node page.
How we are using this module. In one of our projects (for tourists) we have content type 'town' and we need to create for every node map (embed code from google maps). With node_block module we define field 'map' (textarea field type) where we can paste embed code. In module settings we defined auto block for content type 'town' and as a content of block we selected field 'map'. Now for new 'town' node type we need to only past the embed code and blocks are created automatically.
-signup_extra_fields module - this module is a extension of signup module. With this module we can define some extra fields to signup form and store values from fields together with existing signup field values.
In module settings we can define new field which will be shown in signup. We can choose field type, add title and description for field and select content type for which we want to display the field.
We think this modules can be useful also for other Drupal users that's why we want to add them to Drupal projects.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | node_block.zip | 4.97 KB | peem83 |
| #10 | node_block.zip | 4.97 KB | peem83 |
| #8 | node_block.zip | 4.95 KB | peem83 |
| #6 | node_block.zip | 5.13 KB | peem83 |
| #1 | signup_extra_fields.zip | 10.82 KB | peem83 |
Comments
Comment #1
peem83 commentedComment #2
peem83 commentedComment #3
avpadernoWe review a project per applicant; please choose the one you want reviewed, and let us know it.
Comment #4
AjK commentedComment #5
AjK commentedComment #6
peem83 commented1. We changed functions names (solide_node_block_update_block(), solide_node_block_save_block()),
2. The function where we used the query: $sql = db_query("SELECT nid, title FROM {node} WHERE type = '%s'", $node->type); has been removed because it's not needed any more,
3. The function node_block_display_block don't return HTML (we use theme functions),
4. $block['subject'] = $node_blocks[$delta]['title']; - we used 'htmlentities' to solve XSS security issue.
Comment #7
avpadernoMenu callback titles, and descriptions should not be passed to
t()because that is already done by Drupal core code.Comment #8
peem83 commented1. Solved the namespace issue,
2. Changed the hook_schema,
3. Titles and descriptions are not passed to t() in hook_menu,
4. The code formatted according to the Drupal standards.
Comment #9
avpadernoRather than concatenating the string, you should use
t()placeholders.else ifshould be writtenelseif.else, andelseifshould be on a new line.$var.='test'should be$var .= 'test'.In such cases, always add the comma also after the last array item.
TRUE,FALSE,NULL.Those functions can be replaced with a single function.
Comment #10
peem83 commentedThe code formatted according to the Drupal standards, settings pages displayed by one function.
Comment #11
peem83 commentedConstants written in upper case.
Comment #12
peem83 commentedComment #13
avpadernoA theme function is not called directly, but it is called with
theme(<id>, <parameter>…); that is done because a theme function could be overwritten by a module, or by the currently set theme.From the first code line of
theme()is evident that a call astheme('image')could not invoketheme_image(), but invoke any functions that replace it.Optional arguments for which is used their default values should not be passed to the function.
If the default action doesn't do anything, then it can be removed.
If there are more settings pages, then the code should implement more than one menu callback, rather than using a single menu callback that shows different pages basing on the menu arguments.
Also, if the code need to theme a settings page, it is enough it uses
$form['#prefix'] = '<div class="node_block">', and$form['#prefix'] = '</div>'.Those comments are longer than 80 characters, and they are probably not seen. it would be better to use the normal comment style, as used from Drupal core code.
Then, normally people read from left to right; the comments should be probably not noted even if they would be not longer than 80 characters.
I am not sure how the code can be sure
arg(1)is a node ID.The code should better filter the node obtained from
node_load(); showing the data of a node that has been unpublished, or to which the currently logged in user doesn't have access is considered a security issue. The code doesn't seem to check if the user has the permission to see the node, or any data associated with the node.I am not sure that is the correct way to save the settings of a block. This is the first time I see such code being executed from a module that exposes blocks.
Use a placeholder. The first argument of
t()must be a literal string; what you wrote is equivalent tot('Block ' . $block_nr)..
Strings used in the user interface needs to be translated; this includes also the strings used as options for the form fields.
When you set any values in
$form_state['storage'], there is no need to set$form_state['rebuild']because it is implicit.It is enough to use
isset().Comment #14
avpadernoThere have not been replies from the OP in the past 7 days. I am marking this report as .
Comment #15
avpaderno