You are here

function _media_browser_plus_ensure_field in Media Browser Plus 7

Same name and namespace in other branches
  1. 7.2 media_browser_plus.install \_media_browser_plus_ensure_field()

Create a field, unless it exists already.

Note that it's not necessary to check field type here, as that's done in the requirements step.

Parameters

$field: The field definition.

2 calls to _media_browser_plus_ensure_field()
_media_browser_plus_ensure_field_folder in ./media_browser_plus.install
Make sure the field_tags field exists and is of the right type.
_media_browser_plus_ensure_field_tags in ./media_browser_plus.install
Make sure the field_tags field exists and is of the right type.

File

./media_browser_plus.install, line 114
Install file for media_browser_plus.

Code

function _media_browser_plus_ensure_field($field) {
  $existing_field = field_info_field($field['field_name']);
  if (empty($existing_field)) {
    field_create_field($field);
  }
}