You are here

protected function RestfulFormatterHalJson::addHateoasRow in RESTful 7

Add Hateoas to a single row.

Parameters

array $row: A single row array, passed by reference.

1 call to RestfulFormatterHalJson::addHateoasRow()
RestfulFormatterHalJson::prepareRow in plugins/formatter/hal_json/RestfulFormatterHalJson.class.php
Massage the data of a single row.

File

plugins/formatter/hal_json/RestfulFormatterHalJson.class.php, line 184
Contains RestfulFormatterHalJson.

Class

RestfulFormatterHalJson
@file Contains RestfulFormatterHalJson.

Code

protected function addHateoasRow(array &$row) {
  if (!empty($row['self'])) {
    $row += array(
      '_links' => array(),
    );
    $row['_links']['self']['href'] = $row['self'];
    unset($row['self']);
  }
}