You are here

protected function MigrateItemJSON::constructItemUrl in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/json.inc \MigrateItemJSON::constructItemUrl()

The default implementation simply replaces the :id token in the URL with the ID obtained from MigrateListJSON. Override if the item URL is not so easily expressed from the ID.

Parameters

mixed $id:

1 call to MigrateItemJSON::constructItemUrl()
MigrateItemJSON::getItem in plugins/sources/json.inc
Implementors are expected to return an object representing a source item.

File

plugins/sources/json.inc, line 156
Support for migration from JSON sources.

Class

MigrateItemJSON
Implementation of MigrateItem, for retrieving a parsed JSON object given an ID provided by a MigrateList class.

Code

protected function constructItemUrl($id) {
  $count = is_array($id) ? count($id) : 1;
  return preg_replace(array_fill(0, $count, '/:id/'), $id, $this->itemUrl, 1);
}