You are here

public function WsData::addData in Web Service Data 7

Add data to an empty object or replace all existing data

Parameters

mixed $data: A set of data to parse.

string $language [optional]: Language key for the data being added

In some cases, it may require multiple web service requests to load language specific content. You can add each request data result to the same processor object. getData() should then return the merged data keyed by language.

If your webservice returns all data for all languages in a single request, leave $lang to NULL (not LANGUAGE_NONE). LANGUAGE_NONE is considered a valid language and triggers the language keying.

1 call to WsData::addData()
WsData::__construct in ./wsdata.module

File

./wsdata.module, line 282
Main module for wsconfig

Class

WsData
Class definition for Web Service data parser

Code

public function addData($data, $lang = NULL) {
  if (!is_null($lang) and !empty($data)) {
    $this->languages[$lang] = $lang;
    $this->data[$lang] = $this
      ->parse($data);
  }
  else {

    // Default action, just parse the data
    $this->data = $this
      ->parse($data);
  }
}