You are here

function message_notify_field_text_list in Message Notify 7.2

Same name and namespace in other branches
  1. 7 message_notify.rules.inc \message_notify_field_text_list()

Options list; Return the text field attached to the selected message

1 string reference to 'message_notify_field_text_list'
message_notify_rules_action_info in ./message_notify.rules.inc
Implements hook_rules_action_info().

File

./message_notify.rules.inc, line 98
Rules integration for the Message notify module.

Code

function message_notify_field_text_list() {
  $options = array(
    FALSE => '- ' . t('None') . ' -',
  );
  foreach (field_info_instances('message') as $message_type => $instances) {
    foreach ($instances as $field_name => $instance) {
      if (!empty($options[$field_name])) {

        // Field is already in the options array.
        continue;
      }
      $field = field_info_field($field_name);
      if (!in_array($field['type'], array(
        'text',
        'text_long',
        'text_with_summary',
      ))) {

        // Field is not a text field.
        continue;
      }
      $options[$field_name] = $instance['label'];
    }
  }
  return $options;
}