/** * Returns database fields as keys and an associated value taken from a layer as value, ready * for database insert. * * @since 3.0 * * @param MapsLayer $layer * @param integer $pageId The article id of the page the layer should be associated to. * For example "Title::getArticleID()". * * @return array */ public static function databaseRowFromLayer(MapsLayer $layer, $pageId) { // format layer properties array: $properties = array(); foreach ($layer->getProperties() as $key => $prop) { $properties[] = "{$key}={$prop}"; } $properties = implode("\n", $properties); return array('layer_page_id' => $pageId, 'layer_name' => $layer->getName(), 'layer_type' => $layer->getType(), 'layer_data' => $properties); }