Experimental Project

This is a sandbox project, which contains experimental code for developer use only.

This module populates template vars with html fetched by querypath.
The html can be run through different processors like:

  • paths_rel2abs: Transforms relative paths to absolute.
  • remove_elements: Removes elements from the DOM. Surprise :)

Other modules needs to implement a hook in order to add template vars with querypath fetched html:

<?php
function hook_querypath_tpl_vars_settings() {
  return array(
   
'header' => array(
     
// By now only page is supported.
     
'templates' => array('page'),
     
'domain' => 'http://acme.com',
     
'selector' => '#header',
     
'cache' => TRUE,
     
'process' => array(
       
'paths_rel2abs' => array(),
      ),
    ),
   
'navigation' => array(
     
// By now only page is supported.
     
'templates' => array('page'),
     
'domain' => 'http://acme.com',
     
'selector' => '#navigation',
     
'cache' => TRUE,
     
'process' => array(
       
'remove_elements' => array('.region-navigation'),
       
'paths_rel2abs' => array(
         
'exclude' => array(
           
'href' => array('/aktiviteter'),
          ),
        ),
      ),
    ),
  );
}
?>

In this case the variables will be present in page.tpl.php :
<?php if ($qtv_header): ?>
    <?php print $qtv_header; ?>
<?php endif; ?>
<?php if ($qtv_navigation): ?>
    <?php print $qtv_navigation; ?>
<?php endif; ?>

Maintainers for Querypath template vars

  • miksan - 2 commits
    last: 37 weeks ago, first: 37 weeks ago

Issues for Querypath template vars

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports