You are here

protected function RecipeNodeTest::formatHtmlTime in Recipe 7

Format recipe times for display on the HTML export.

@todo This horrible time display logic needs to be eliminated.

1 call to RecipeNodeTest::formatHtmlTime()
RecipeNodeTest::testRecipeContent in src/Tests/RecipeNodeTest.php
Creates a recipe node using the node form and test the module settings.

File

src/Tests/RecipeNodeTest.php, line 506

Class

RecipeNodeTest
Tests the functionality of the Recipe content type and Recipe blocks.

Namespace

Drupal\recipe\Tests

Code

protected function formatHtmlTime($time) {
  if ($time < 60) {
    return format_plural($time, '1 minute', '@count minutes');
  }
  elseif ($time % 60 == 0) {
    return format_plural($time / 60, '1 hour', '@count hours');
  }
  else {
    return t('!time hours', array(
      '!time' => recipe_ingredient_quantity_from_decimal($time / 60),
    ));
  }
}