Description

This module adds the ability for module creators and developers to add formatter-like settings forms to the Field UI Display Overview form for their field_extra_fields. The goal is to provide a way for developers to supply basic per-bundle configuration options to their extra_fields similar to the manner in which field_formatters can take display settings. The settings options handled by this module are stored in field_bundle_settings along with the extra_field visibility options for easy saving and retrieval.

To create a settings form for an extra field a developer should supply a `settings callback` in their `hook_field_extra_fields()` definition, and from that callback return a valid Form API renderable array that can be merged in to the Field UI Display Overview form. This module also allows for an optional render callback to be set, allowing extra_fields to be automatically rendered with their settings. Below is an example usage of this module from the project's README:

Example Usage

  function hook_field_extra_fields() {
    $extra['entity_type']['bundle'] = array(
      'display' => array(
        'field_name' => array(
          'label' => 'Field Name',
          'weight' => 0,
          //
          // Below are the callbacks for extrafield_settings
          'callback' => 'example_field_name_render',
          'settings callback' => 'example_field_name_settings_form'
        ),
      ),
    );
    return $extra;
  }

  function example_field_name_settings_form($settings) {
    return array(
      'link_text' => array(
        '#type' => 'textfield',
        '#title' => isset($settings['link_text']) ? $settings['link_text'] : t('Click here'),
        '#description' => t('Link text for my custom button'),
      ),
    );
  }

  function example_field_name_render($entity, $type, $view_mode, $settings) {
    return array(
      '#theme' => 'link',
      '#title' => isset($settings['link_text']) ? $settings['link_text'] : t('Click here'),
      '#path' => entity_uri($type, $entity),
      '#options' => array(
        'attributes' => array(),
        'html' => FALSE,
      ),
    );
  }

Project Info

Project Page: https://www.drupal.org/project/extrafield_settings
Git clone: git clone --branch 7.x-1.x https://git.drupal.org/project/extrafield_settings.git

Manual Reviews of other projects

https://www.drupal.org/node/2597211#comment-12050759

Comments

johnnybgoode created an issue. See original summary.

PA robot’s picture

Status: Active » Needs work

Git clone command for the sandbox is missing in the issue summary, please add it.

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

johnnybgoode’s picture

Issue summary: View changes
johnnybgoode’s picture

Issue summary: View changes

Update git clone command

johnnybgoode’s picture

Issue summary: View changes
johnnybgoode’s picture

Status: Needs work » Needs review
jemond’s picture

https://www.drupal.org/node/1587704

1.1 - Pass
2.1 - Pass
3.1 - Pass
4.1 - Pass
4.2 - Pass
5.1 - Pass
5.2 - Pass
5.3 - Pass
6.1 - Fix needed
7.1 - Pass

Two minor issues:
1. You have lines longer than 80 chars in the readme
2. You are missing a period in the @file block

Once fixed this can be RTBC

johnnybgoode’s picture

The above issues are fixed: https://pareview.sh/node/1679

jemond’s picture

Status: Needs review » Reviewed & tested by the community

Nice! Making RTBC

sharma.amitt16’s picture

Status: Reviewed & tested by the community » Needs work

Please implement hook_help() in your module file.

johnnybgoode’s picture

Status: Needs work » Needs review

@sharma.amitt16 I implemented hook_help(). As this module is primarily geared towards developers most of the guidance resides in the README file, and this is noted in hook_help() as well.

Cyclonecode’s picture

https://www.drupal.org/node/1587704

1.1 - Pass
2.1 - Pass
3.1 - Pass
4.1 - Pass
4.2 - Pass
5.1 - Pass
5.2 - Pass
5.3 - Pass
6.1 - Fail - check https://pareview.sh/node/1817
7.1 - Pass

Cyclonecode’s picture

Status: Needs review » Needs work
PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

Ravi Cmsminds’s picture

I checked your module and found some issues and recommendations that you may be interested in :

FILE: /root/repos/pareviewsh/pareview_temp/extrafield_settings.module
--------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------
202 | ERROR | [x] Case breaking statements must be followed by a
| | single blank line
203 | WARNING | [ ] Code after RETURN statement cannot be executed
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------