CVS edit link for joe casey

I am submitting blocktable.module, which allows developers or designers to embed blocks within a region into an HTML table. I wrote this in response to a problem I encountered while trying to position several blocks in the content region of a specialized page. I intend to maintain this module, and enhance it if there is enough interest in it.

Comments

joe casey’s picture

StatusFileSize
new9.54 KB
joe casey’s picture

Status: Postponed (maintainer needs more info) » Needs review
avpaderno’s picture

Status: Needs review » Needs work
Issue tags: +Module review

Hello, and thank you for applying for a CVS account.

As per requirements, the motivation should include more than 2 sentences of module features, and a comparison with the existing solutions.

joe casey’s picture

Status: Needs work » Needs review

I don't seem to be able to edit the motivation myself. An updated version is below.

The only description of the motivation that I found was at http://drupal.org/node/539608
Where can I find the requirements you mention?

Thanks for your attention.

UPDATED MOTIVATION
------------------

I am submitting blocktable.module, which allows developers or designers to embed blocks within a region into an HTML table. The user, a developer or designer, provides HTML table markup with indications for where the blocks should go. When the page is built the blocks are placed in the provided table markup. Table cells may contain 0, 1, or more blocks. Any table markup can be used, including styling, colspan, widths, etc. The blocks themselves, and any enclosing styling provided by the theme, are not changed. The user can specify which pages Blocktable is applied to in the same way that block visibility is set.

This provides an additional method for positioning blocks in region. For example, Blocktable makes it easy to creates a multi-column layout within a region.

The only existing solutions are to use block-level CSS for positioning, or modify the theme. Getting the desired results with block-level CSS can be difficult or impossible within the confines of a particular region in a particular theme. Modifying the theme is also difficult, and is a global solution to what may be a local (one or a few pages) problem.

I was unable to find any other module that does anything similar to this.

An unintended feature of the code used in Blocktable is that any other arbitrary HTML, not just a table, could be used to contain the blocks. I don't have a use case for this, but the capability is there.

I wrote this in response to a problem I encountered while trying to position several blocks in the content region of a specialized page.

I intend to maintain this module, and enhance it if there is enough interest in it.

brianV’s picture

Perhaps I am missing something, but what does this offer that Panels doesn't?

avpaderno’s picture

Status: Needs review » Needs work
joe casey’s picture

Status: Needs work » Needs review

There are some use cases where Blocktable could be thought of as a 'Very Poor Man's Mini-Panel'. In this respect, the key differentiator is the ability to place your blocks in a table. Sometimes people want or need to use a table for some reason, including layout requirements. Panels offers a variety of layout choices, but they are all CSS-based.

I should also mention that Blocktable has no requirements, very little overhead, very easy learning curve, and can be implemented and updated by relatively low-skilled staff.

brianV’s picture

Status: Needs review » Needs work

Joe,

Looks like you've followed the coding and documentation standards really closely - this is one of the cleanest-looking modules I've reviewed!

  1. Please make sure all inline comments start with a capital and end wit a period:
    // no blocktable and no blocks, ignore this region
  2. You can remove your require_once 'blocktable_ui.inc'; snippet, and just place it in your hook_menu() implementation, so that it is only included on calls for your configuration form. ie:
    $items['admin/build/blocktable'] = array(
      'page callback' => 'drupal_get_form',
      'page arguments' => array('blocktable_multiform'),
      'title' => 'Blocktable',
      'description' => 'Put blocks within a region into an HTML table',
      'access arguments' => array('administer blocktable'),
      'file' => 'blocktable_ui.inc',
      'type' => MENU_NORMAL_ITEM,
    );
    

That's all I can really find at this point, though once those are fixed, I'll re-review to double check everything.

joe casey’s picture

StatusFileSize
new9.5 KB

Updated the comments and moved the blocktable_ui.inc reference into hook_menu.

The zip file contains all the pieces, but only blocktable.module and blocktable_ui.inc are changed.

brianV’s picture

Status: Needs work » Reviewed & tested by the community

I've re-reviewed the module and everything looks good.

It looks like you did a really nice job on it.

joe casey’s picture

Thanks, Brian. I put a lot of work into it. I've been retraining myself as a Drupaler. I've put together a few Drupal sites, but this is my first module. I'm really enjoying Drupal and the Drupal community.

avpaderno’s picture

Status: Reviewed & tested by the community » Needs work
  1. t() is available inside hook_install(); there is no need to use st() instead. If would not be available, then the code should use the following snippet (as used in <code>hook_requirements()).
      $t = get_t();
    
      drupal_set_message($t(/* ...*));
    
  2. l() should not be used together t(). As reported in the documentation for t():

    Here is an example of incorrect usage of t():

      $output .= t('<p>Go to the @contact-page.</p>', array('@contact-page' => l(t('contact page'), 'contact')));
    

    Here is an example of t() used correctly:

      $output .= '<p>'. t('Go to the <a href="@contact-page">contact page</a>.', array('@contact-page' => url('contact'))) .'</p>';
    

    To notice that the correct placeholders for links don't start with !.

  3. To get the path where a module is installed, Drupal has the function drupal_get_path().
  4. The help text returned from hook_help() is normally returned directly without to pass it through any filter functions.
  5. /**
     * Get all blocks for a region, regardless of user or role.
     * Adapted from block_list in block.module.
     *
     * @param $region
     *  Regions for the current theme.
     * @param $theme
     *  The current default theme.
     * @return
     *  Array of block objects.
     */
    

    The first sentence of a Doxygen function comment should be in third person.

  6. See http://drupal.org/coding-standards to understand how a module should be written; in particular see how Drupal variables, global PHP variables, classes, functions, and local PHP variables defined from the module should be named.
  7.     $error_2 = t(' Actual: ') . $actual_string . "<br />";
        $error_3 = t(' Defined:') . $markup_string;
        $error_string = $error_1 . $error_2 . $error_3;
    

    Use t()-placeholders, in such cases; in that way, the string passed to t() gives to translator users the contenxt in which the phrase is translated (in many languages, a English word is translated differently basing on the context provided from the sentence).
    When possible, it is better to not split a sentence in phrases that are passed separately to t().

  8. The module define the permission use PHP for blocktable visibility, but it doesn't seem it checks the user has that permission where it should (e.g. right before to call drupal_eval()).
joe casey’s picture

StatusFileSize
new9.5 KB

1. Use t() instead of st(). - Done.

2. l() should not be used together t(). - Done.

3. To get the path where a module is installed, Drupal has the function drupal_get_path(). - Done.

4. The help text returned from hook_help() is normally returned directly without to pass it through any filter functions.

- This help doesn't display properly unless it is filtered - line breaks and spacing are lost.

5. The first sentence of a Doxygen function comment should be in third person. - Done.

6. See http://drupal.org/coding-standards. - Refers to #5? Done.

7. Use t()-placeholders. - Done.

8. The module define the permission "use PHP for blocktable visibility", but it doesn't seem it checks the user has that permission where it should (e.g. right before to call drupal_eval()).

- It is the configurer, not the end user (visitor), who needs this permission. The check is made when the configuration form is built, so those without permission do not see the 'use PHP' section and can't fill it out. This follows the logic in block.module.

joe casey’s picture

Status: Needs work » Needs review
avpaderno’s picture

Assigned: Unassigned » avpaderno
Status: Needs review » Fixed

Point #6 was referring to the function get_bids(), which doesn't have the correct name; any function defined from the module must have a name prefixed by the module name. The same is true for Drupal variables, and global PHP variables.

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, 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.

I thank all the dedicated reviewers as well.

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes
Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.