You are here

function masonry_formatter_boolean in Masonry API 7

Convert a boolean variable to a string.

Parameters

$boolean: The boolean variable to convert.

$true_value: The string if boolean is true. Set to NULL to use default value (Yes).

$false_value: The string if boolean is false. Set to NULL to use default value (No).

Return value

A string-representation of the boolean variable.

1 call to masonry_formatter_boolean()
masonry_formatter_field_formatter_settings_summary_alter in masonry_formatter/masonry_formatter.module
Implements hook_field_formatter_settings_summary_alter().

File

masonry_formatter/masonry_formatter.module, line 285
Allows multi-value fields to be displayed in a jQuery Masonry grid.

Code

function masonry_formatter_boolean($boolean, $true_value = NULL, $false_value = NULL) {

  // Set default values
  if (empty($true_value)) {
    $true_value = t('Yes');
  }
  if (empty($false_value)) {
    $false_value = t('No');
  }

  // Convert boolean to string
  if ($boolean) {
    return $true_value;
  }
  else {
    return $false_value;
  }
}