You are here

function postal_code_help in Postal Code 7

Same name and namespace in other branches
  1. 8 postal_code.module \postal_code_help()

Implements hook_help().

File

./postal_code.module, line 28

Code

function postal_code_help($path, $arg) {
  require_once DRUPAL_ROOT . "/includes/iso.inc";
  if ($path == 'admin/help#postal_code') {
    $country_list = _country_get_predefined_list();
    $postal_code_validation_data = postal_code_validation();
    $country_list_items = '';
    foreach ($postal_code_validation_data as $country => $info) {
      $country_list_items .= '<li>' . $country_list[drupal_strtoupper($country)] . '</li>';
    }
    $configurl = url('admin/config/postal_code');
    $conturl = url('admin/structure/types');
    $helptext = <<<EOT
<p>A very minimal D7 Postal Code field with validation for one country (listed below) or a combination of countries.</p>

<p>Countries with validation:
<ul>
  {<span class="php-variable">$country_list_items</span>}
</ul>
</p>
<p>To configure this module, navigate to the <a href="{<span class="php-variable">$configurl</span>}">Structure > Postal Code</a>. Selecting countries in the 'Valid "Any" Countries' list will validate the submitted postal code against regexes for those countries using the "Any Country" widget type. If you want submissions validated, make sure to check the "Validate" checkbox.</p>
<p>To configure content types to add this field type, navigate to <a href="{<span class="php-variable">$conturl</span>}">Structure > Content Types</a>. Select "manage fields" beside the content type (eg: blog, page, article...) and follow the normal procedure to add a new field, choosing "Postal Code" under field type. Beneath "Widget" a number of selections will appear for each country type, as well as an "Any" country which is configurable (see above) to validate any included country's postal code.</p>
<p>Thanks to <a href="http://www.pixelenvision.com/1708/zip-postal-code-validation-regex-php-code-for-12-countries/">Pixel Envision</a> and <a href="http://geekswithblogs.net/MainaD/archive/2007/12/03/117321.aspx">Geeks With Blogs</a> for the list of countries and <a href="http://www.knowclassic.com">Classic Graphics</a> for the time to complete it.</p>
EOT;
    return t($helptext);
  }
}