You are here

function word_link_get_node_fields in Word Link 7

Same name and namespace in other branches
  1. 8 word_link.module \word_link_get_node_fields()

Get textarea fields of given content type.

Parameters

string $type: The bundle name for which to return fields.

Return value

array Array with textarea fields or empty array if it's not found.

1 call to word_link_get_node_fields()
word_link_admin_settings in ./word_link.admin.inc
Form builder for a settings page.

File

./word_link.module, line 532
This module allows users to replace previously defined words to the links.

Code

function word_link_get_node_fields($type) {
  $fields = field_info_instances('node', $type);
  $text_fields = array();
  foreach ($fields as $name => $field) {
    if ($field['widget']['type'] == 'text_textarea_with_summary' || $field['widget']['type'] == 'text_textarea') {
      $text_fields[$field['field_name']] = $field['label'];
    }
    elseif ($field['widget']['type'] == 'field_collection_embed') {
      $fc_fields = field_info_instances('field_collection_item', $field['field_name']);
      foreach ($fc_fields as $fc_name => $fc_field) {
        if ($fc_field['widget']['type'] == 'text_textarea_with_summary' || $fc_field['widget']['type'] == 'text_textarea') {
          $text_fields[$field['field_name']][$field['field_name'] . '__' . $fc_field['field_name']] = $fc_field['label'];
        }
      }
    }
  }
  return $text_fields ? $text_fields : array();
}