Skip to content
Snippets Groups Projects
Commit fd60b4bc authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-183] Merging from testing into staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@1013 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent c7685ace
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,7 @@ class Unl_Migration_Tool
private $_hrefTransform = array();
private $_hrefTransformFiles = array();
private $_menu = array();
private $_breadcrumbs = array();
private $_nodeMap = array();
private $_pageTitles = array();
private $_log = array();
......@@ -220,6 +221,7 @@ class Unl_Migration_Tool
// Parse the menu
$this->_processMenu();
$this->_process_blocks();
$this->_process_breadcrumbs();
$this->_state = self::STATE_PROCESSING_PAGES;
}
......@@ -277,6 +279,7 @@ class Unl_Migration_Tool
$this->_createMenu();
$this->_create_blocks();
$this->_create_breadcrumbs();
$this->_state = self::STATE_DONE;
}
......@@ -515,6 +518,40 @@ class Unl_Migration_Tool
->execute();
}
private function _process_breadcrumbs() {
$content = $this->_getUrl($this->_baseUrl);
$html = $content['content'];
$dom = new DOMDocument();
$dom->loadHTML($html);
$breadcrumbs_node = $dom->getElementById('breadcrumbs');
if (!$breadcrumbs_node) {
return;
}
$link_nodes = $breadcrumbs_node->getElementsByTagName('a');
$list_nodes = $breadcrumbs_node->getElementsByTagName('li');
$unlinked_node = FALSE;
if ($list_nodes->length > $link_nodes->length) {
$unlinked_node = TRUE;
}
// Scan each of the breadcrumb links, skipping the first and the last (but only if there's an un-linked "true" last breadcrumb)
for ($i = 1; $i < $link_nodes->length - ($unlinked_node ? 1 : 0); $i++) {
$link_node = $link_nodes->item($i);
$this->_breadcrumbs[] = array(
'text' => trim($link_node->textContent),
'href' => $this->_makeLinkAbsolute($link_node->getAttribute('href', ''))
);
}
}
private function _create_breadcrumbs() {
$current_settings = variable_get('theme_unl_wdn_settings', array());
$current_settings['intermediate_breadcrumbs'] = $this->_breadcrumbs;
variable_set('theme_unl_wdn_settings', $current_settings);
}
private function _processPage($path)
{
$this->_addProcessedPage($path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment