1. A Field offering province, city, and county of China

2. project link

3. git clone --recursive --branch 7.x-1.x lcnphp@git.drupal.org:sandbox/lcnphp/1611614.git

4. both for Drupal 6 and 7

CommentFileSizeAuthor
#2 demo.png7.87 KBlcnphp
QQ截图20120606175010.png7.87 KBlcnphp

Comments

DavidS’s picture

Status: Needs review » Needs work

Why you didn't implement formatter for Address Field? Here is API documentation: http://drupalcode.org/project/addressfield.git/blob/refs/heads/7.x-1.x:/addressfield.api.php. Also you can see example sub-module in the addressfield module directory.

There is some errors in code style when I ran it using PAReview. Here is results: http://ventral.org/pareview/httpgitdrupalorgsandboxlcnphp1611614git

lcnphp’s picture

StatusFileSize
new7.87 KB
DavidS’s picture

Also, you need to clean up your master branch. The most direct documentation on this is Moving from a master branch to a version branch (see p.5).

Also, please fix the name of the D6 branch: it should be called not 6.x.-1.x but 6.x-1.x.

Also after some manual reviewing I found this code:

function china_address_install() {
  @ini_set('memory_limit', '750M');
  @set_time_limit(240);

because it won't work any time because of some server limitations.
So I can suggest some possible solutions:

  1. You can implement hook_requirements in install phase and ask user to increase server capacities
  2. Use Drupal Batch API (maybe import this data not during installation but after installation show message that user should run importing process in some admin area)
lcnphp’s picture

Status: Needs review » Needs work

Implementation formatter for Address Field was done.

lcnphp’s picture

Status: Needs work » Needs review

1. add implement formatter for Address Field

2. fix some code style error

DavidS’s picture

Some comments on new changes:

  1. Please, see the comments now of the PAReview - you need to rename functions of the address field formatter to start with your module name.
  2. It seems you now suggest two implementations for end user - your own field and addressfield formatter (plugin for addressfield module). Do we really need both these implementations?
  3. Regarding the hook_install. Using this solution you didn't simplify the query, but you have increased the load on mysql server. because now, instead of one query, you are executing two queries.
  4. You don't need to implement hooks if you don't write code in it (I'm talking about the hook_uninstall()).
rogical’s picture

Status: Needs work » Closed (fixed)

the author said no need anymore.