I am trying to get 6.x-1.x-dev working with my own ddblock theme so that I can change the image sizes. I set the Block Admin Template drop-down to "Custom". I populated the Custom Template text field with my custom theme name "uprightfg1" and created a pair of .tpl.php files under mytheme/custom/modules/ddblock called ddblock-cycle-block-content-uprightfg1.tpl.php and ddblock-cycle-pager-content-uprightfg1.tpl.php.

I also created my own CSS under mytheme/custom/modules/ddblock/uprightfg1 called ddblock-cycle-uprightfg1.css.

However when I cleared the cache and displayed the page with my block on, I got no output from the theme call in ddblock.module.

   $block_content = theme(
      'ddblock_cycle_block_content',
      $settings,
      $content
    );

I debugged through the theme() function and found that the .tpl.php files were not being discovered, because - I think - the $settings['template'] array item was still set to 'custom' and the name of my custom theme was in $settings['custom_theme'] which I don't think theme() recognises.

Changing the line that sets $settings['template'] to do this:

'template' => ($template == 'custom' ? $custom_template : $template),

resulted in my .tpl.php files being discovered.

Can anyone confirm this issue?

Comments

sp3boy’s picture

Investigating a different problem, I spotted this code in ddblock.module function template_preprocess_ddblock_cycle_block_content(). I'm wondering if my previous workaround was hitting the problem in the wrong place and the candidate template files are not being discovered because $vars['ddblock_template'] is never set?

  // additional candidate template files
  if ($vars['ddblock_template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }

The equivalent code in template_preprocess_ddblock_cycle_pager_content() looks more sensible:

  // additional candidate template files
  if ($settings['template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-pager-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-pager-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-pager-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-pager-content-'. $settings['delta'];
  }
sp3boy’s picture

Well my second idea is OK as long as all the references to $settings['template'] in the custom .tpl.php files are changed to $settings['custom_template'], otherwise the custom CSS is not loaded and the DIV.ddblock-cycle-custom template class will not match the CSS.

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

At the Create a new custom ddblock theme part of the advanced slideshow tutorial you can read what steps have to be done when creating your own custom ddblock theme. One of the steps is changing $template to $custom_template.

Using 'ddblock_template' in the code below is a bug

  // additional candidate template files
  if ($vars['ddblock_template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }

It should be:

  // additional candidate template files
  if ($vars['template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }

Thanks for finding this bug.

I think this will solve the issue, please let me know.

sp3boy’s picture

Thanks for the link to the tutorial - I think your code suggestion matches my thoughts except for the first line - shouldn't that be $settings['template'] , as in:

 <?php
  // additional candidate template files
  if ($settings['template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
?>
ppblaauw’s picture

You are right, it should be:

  // additional candidate template files
  if ($settings['template'] == 'custom') {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['custom_template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }
  else {
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['template'];
    $vars['template_files'][] = 'ddblock-cycle-block-content-'. $settings['delta'];
  }

Thanks again
Committed this to the dev release

That it still work, comes from the line

if ($settings['template'] == 'custom') {
  $vars['ddblock_slider_settings']['custom_template'] = $settings['custom_template'];
}