You are here

protected function RecipeNodeTest::formatTime in Recipe 7

Format recipe times for display.

@todo This function and the code its copied from in theme_recipe_summary() need to be replaced with an equivalent function in recipe.module.

1 call to RecipeNodeTest::formatTime()
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 484

Class

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

Namespace

Drupal\recipe\Tests

Code

protected function formatTime($time) {
  $_o_minutes = $time;
  $_hours = floor($_o_minutes / 60);
  $_minutes = $_o_minutes - $_hours * 60;
  $_text = '';
  if ($_hours > 0) {
    $_text = format_plural($_hours, '1 hour', '@count hours');
  }
  if ($_minutes > 0) {
    if (strlen($_text) > 0) {
      $_text .= ', ';
    }
    $_text .= format_plural($_minutes, '1 minute', '@count minutes');
  }
  return $_text;
}