When using mobile number as a field in user, it works great but when using it in a content type as a field, it doesnt show when
later looking at the created node. When doing a list using views, having a table showing the above nodes (the content type) the number shows in the view.

CommentFileSizeAuthor
#3 3091334-3.patch538 bytesmohit.bansal623

Comments

arne_hortell created an issue. See original summary.

namontague’s picture

The reason this is happening is due to the default field formatter set in the field_info hook.
The formatter used does not exist and results in no field being displayed when viewing the content.

A walk around for this bug is to simply save the manage display page for the content type as this will now set the field formatter to one that exists (from the dropdown).

To fix the code you need to change the function mobile_number_field_info:

change the value set for "default_formatter" to "mobile_number_international".

'default_formatter' => 'mobile_number_international',

function mobile_number_field_info() {
  return array(
    'mobile_number' => array(
      'label' => t('Mobile Number'),
      'description' => t('This field stores mobile numbers.'),
      'settings' => array(
        'unique' => MOBILE_NUMBER_UNIQUE_NO,
      ),
      'instance_settings' => array(),
      'default_widget' => 'mobile_number_default',
      'default_formatter' => 'mobile_number_international',
      'property_type' => 'mobile_number',
      'property_callbacks' => array('mobile_number_property_callback'),
    ),
  );
}

Once applied and cache is cleared the bug will be fixed.

mohit.bansal623’s picture

Status: Active » Needs review
StatusFileSize
new538 bytes

@namontague - Thanks for the solution. Creating a patch for the same.