function globallink_block_get_xml in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_block/globallink_block.inc \globallink_block_get_xml()
- 7.5 globallink_block/globallink_block.inc \globallink_block_get_xml()
Gets XML data from specific block.
Parameters
string $bid: The block ID.
array $title_string_arr: Array of block's title strings.
array $body_string_arr: Array of block's body strings.
Return value
array Associative array of block XML data.
2 calls to globallink_block_get_xml()
- globallink_block_get_translations_for_row_id in globallink_block/
globallink_block_receive.inc - Gets block translations by row ID.
- globallink_block_send_blocks_for_translations in globallink_block/
globallink_block.inc - Sends blocks for translation.
File
- globallink_block/
globallink_block.inc, line 95
Code
function globallink_block_get_xml($bid, $title_string_arr, $body_string_arr) {
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = TRUE;
$root = $dom
->createElement('content');
$dom
->appendChild($root);
$id = $dom
->createAttribute('bid');
$id->value = $bid;
$root
->appendChild($id);
$custom_block = block_custom_block_get($bid);
if ($title_string_arr) {
globallink_insert_child_element($dom, $root, 'block', $title_string_arr['source'], array(
'name' => 'title',
'lid' => $title_string_arr['lid'],
'location' => $title_string_arr['location'],
'context' => $title_string_arr['context'],
));
}
if ($body_string_arr) {
$format = isset($custom_block['format']) ? $custom_block['format'] : '';
globallink_insert_child_element($dom, $root, 'block', $body_string_arr['source'], array(
'name' => 'body',
'lid' => $body_string_arr['lid'],
'location' => $body_string_arr['location'],
'context' => $body_string_arr['context'],
'format' => $format,
));
}
$xml = $dom
->saveXML();
return $xml;
}