Problem/Motivation

Part of meta-issue #1310084: [meta] API documentation cleanup sprint

Proposed resolution

Correct the following in the core field_ui module:

  • Ensure that all @return lines are preceded by a blank line.
  • Ensure that @see and @ingroup lines are always at the end of docblocks.
  • Ensure that all lines in doxygen blocks are 80 characters or fewer (excluding the terminal newline).
  • Ensure that all functions, classes, interfaces, and methods have one-line summaries that are clear, use the correct verb tense, and follow specific standards in http://drupal.org/node/1354.
  • Make incidental style and grammar corrections only to those docblocks already being updated.

Remaining tasks

Patch needs to be rolled.

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

Do you plan to patch this module? If so can you assign the issue to yourself and also add your name to the summary issue? Thanks!

sven.lauer’s picture

Assigned: Unassigned » sven.lauer

Since there hasn't been any word from Lars, I claim this one for now.

Lars Toomre’s picture

Go ahead sven. As I explained in one of the other threads, I simply created the issue, but did not assign it to myself. (Same with another of the other modules too.)

sven.lauer’s picture

Patch attached.

I opened #1347888: @param / @return docs missing in much of Field UI module, as there are @param/@return missing almost everywhere (I assigned that issue to myself, but won't roll a patch until this patch here is in --- as conflicts are virtually guaranteed).

I had to get creative, as many of the paths of page callbacks and form constructors vary by entity --- and this is not handled via %-placeholders. So I went with the PLACEHOLDER_IN_CAPS convention. Downside: The meaning of the placeholder has to be explained in every function. Alternative ideas welcome.

sven.lauer’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, doc-cleanup-field_ui-module-1326638-1.patch, failed testing.

xjm’s picture

jhodgdon’s picture

Looks pretty good! A few things to fix:

a)

 /**
- * Pre-render callback for field_ui_table elements.
+ * Pre-render callback: Performs pre-render tasks on field_ui_table elements.

field_ui_table should have () after it I think, to make a link to this function (or should be changed to the actual function name if that is not correct)?

Other places need () too, such as:

+ * Form validation handler for field_ui_field_overview_form.

b)

+ * Path: BUNDLE_ADMIN_PATH/fields
+ *
+ * where BUNDLE_ADMIN_PATH is the path stored in the ['admin']['info'] property
+ * in the return value of hook_entity_info().

Hmmm... You had asked about whether this was a good structure... I think it's OK, except I guess I would move the "where BUNDLE..." up onto the same line as Path:. It shouldn't be a new paragraph? In the case of the ones where the paths are a list, I would just remove the blank line between the paths list and the "where..." sentence.

c) Typo (spelling of "row"):

+ * Validates the 'add existing field' roew of field_ui_field_overview_form().

d) Not following standards:

 /**
- * Form submit handler for multistep buttons on the 'Manage display' screen.
+ * Form submission handler for multistep buttons on the 'Manage display' screen.

Should include the form function name rather than "on the manage display screen". Probably the following doc block for the Ajax handler should too?

e) Typo (not your fault) field -> fields

+ * Returns an array of existing field to be added to a bundle.

f) Should follow the form submission template:

 /**
- * Save a field's settings after editing.
+ * Saves a field's settings after editing.
+ *
+ * @see field_ui_field_settings_form()
  */
 function field_ui_field_settings_form_submit($form, &$form_state) {

This one too:

 /**
  * Form submit handler for field instance settings form.

g)

+ *
+ * @return
+ *   The instance array.
  */
 function field_ui_menu_load($field_name, $entity_type, $bundle_name, $bundle_pos, $map) {

Normally we don't need return value docs in menu callbacks... but I could be convinced that it is OK here. Maybe it should say "the field instance array" rather than "the instance array" though?

h) Missing period at the end:

+ * Title callback: Returns the name of a given instance

i) Duplicated word "formatter":

   /**
-   * Test formatter formatter settings.
+   * Tests formatter formatter settings.
sven.lauer’s picture

Arg, I should have caught at least some of these things.

Addressed all of the, one way or another. Comments:

(a) 'field_ui_table' is an element #type. I went with the format we agreed on in #1347890: Clean up API docs for file module, and changed the summary to "Render API callback: Performs pre-render tasks on field_ui_table elements." and then included a line in the docblock saying "This function is assigned as a #pre_render callback in field_ui_element_info()."

Made the parallel change for field_ui_field_edit_instance_pre_render() for consistency.

(g) I really think it makes sense to document the return value here, as this is a menu loader function---and these do not have a common return value. Rather, it varies by loader what they return. I did change the return to to "The field instance array." and also added a @ingroup field (though perhaps an @see or a link would be better?). The docgroup page of the field group is where the keys of instance arrays are documented.

sven.lauer’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
27.58 KB

This is looking really good! I only found this:

a)

+ * Populates display settings for a new  view mode from the default view mode.

(extra space between new and view).

b)

+ * Proves common functionality for the Field UI test classes.
  */
 class FieldUITestCase extends DrupalWebTestCase {

Proves -> Provides

c)

+   *   Admin path of the bunde that the field is to be attached to.
 

bunde -> bundle

Since these were all simple typos, I just edited the patch file directly and re-uploaded it (after verifying I only made those three changes). Unless the testbot objects, I think we can call this done!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Looks good to me. Committed/pushed to 8.x.

Status: Fixed » Closed (fixed)

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

xjm’s picture

Version: 8.x-dev » 7.x-dev
Assigned: sven.lauer » Unassigned
Status: Closed (fixed) » Needs review
Issue tags: +Needs backport to D7
FileSize
14.39 KB
23.07 KB

Attached removes the menu callback changes, plus a hunk for field_ui_field_edit_form_delete_submit(), which does not exist in D7.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

These all look like good changes to get into D7. Thanks!

My personal favorite piece of this patch:

-  // Pick the elements that need ro receive the ajax-new-content effect.
+  // Pick the elements that need to receive the ajax-new-content effect.

ro ro ro your boat!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, d7-field-ui.patch, failed testing.

xjm’s picture

Status: Needs work » Reviewed & tested by the community

Bot goof.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed "ro" 7.x! ;) Thanks.

The only thing I found in glancing through was:

+/**
+ * @file
+ *   Right-to-left specific stylesheet for the Field UI module.
+ */

That extra indentation shouldn't be there, so I removed it, both in D7 and D8.

jhodgdon’s picture

Status: Fixed » Postponed (maintainer needs more info)

Hmmm. Are you saying that CSS files should not have @file comments at the top?

It looks like right now some do and some don't. My opinion is that all files should have them... thoughts?

There's nothing specific on
http://drupal.org/node/302199
about @file blocks, but it does basically say to follow the PHP block doc standards when documenting sections of your CSS file...

jhodgdon’s picture

Should we open a separate issue to discuss that?

sven.lauer’s picture

I think webchick simply meant that

+/**
+ * @file
+ *   Right-to-left specific stylesheet for the Field UI module.
+ */

should have been

+/**
+ * @file
+ * Right-to-left specific stylesheet for the Field UI module.
+ */

And not that there should not be any @file header.

webchick’s picture

Status: Postponed (maintainer needs more info) » Fixed

Yep, that's right.

jhodgdon’s picture

Duh. I can't read. :)

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