You are here

function availability_calendar_booking_formlet_format_key in Availability Calendars 7.5

Same name and namespace in other branches
  1. 7.3 booking_formlet/availability_calendar_booking_formlet.module \availability_calendar_booking_formlet_format_key()
  2. 7.4 booking_formlet/availability_calendar_booking_formlet.module \availability_calendar_booking_formlet_format_key()

Helper function for the formatter summary to display what preset value will be used.

Parameters

string $key: The key, something like 'key1' or key1[subkey1][subkey2].

Return value

string The key but with the first part also enclosed in angle brackets, thus something like [key1] or [key1][subkey1][subkey2].

1 call to availability_calendar_booking_formlet_format_key()
availability_calendar_booking_formlet_field_formatter_settings_summary_inc in booking_formlet/availability_calendar_booking_formlet.inc
Implements hook_field_formatter_settings_summary(). @link http://api.drupal.org/api/drupal/modules--field_ui--field_ui.api.php/fun...

File

booking_formlet/availability_calendar_booking_formlet.inc, line 359
General helper methods for Availability Calendar Booking formlet to make the .module file smaller:

Code

function availability_calendar_booking_formlet_format_key($key) {
  $key = check_plain($key);

  // Put angle brackets around (first part of) the key.
  $pos = strpos($key, '[');
  if ($pos === FALSE) {
    $key = "[{$key}]";
  }
  else {
    $key = '[' . substr($key, 0, $pos) . ']' . substr($key, $pos);
  }
  return $key;
}