Skip to content

Commit

Permalink
addtile now returns either empty or the new tile ID for #39
Browse files Browse the repository at this point in the history
  • Loading branch information
elifoster committed Jun 6, 2016
1 parent ac2b21f commit dc9852a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion api/TilesheetsAddTileApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ public function execute() {
}

$res = TileManager::createTile($mod, $name, $x, $y, $this->getUser(), $summary);
$this->getResult()->addValue('edit', 'addtile', array($name => $res));
$return = array($name => $res);

// Get the new tile's ID.
if ($res) {
$selectResult = $dbr->select(
'ext_tilesheet_items',
'`entry_id`',
array('item_name' => $name, 'mod_name' => $mod, 'x' => $x, 'y' => $y),
__METHOD__
);
$id = $selectResult->current()->entry_id;
$return[$name] = $id;
}
$this->getResult()->addValue('edit', 'addtile', $return);
}
}

0 comments on commit dc9852a

Please sign in to comment.