Allow another module defined new SimpleAds type and define template for this

Created on 17 July 2013, almost 11 years ago
Updated 9 June 2023, about 1 year ago

In module simpleads we are only support 3 type default: text, image, flash. And in another module we don't have way to define a new type of simpleads. In this case, I thinks we need support another module define new simpleads type, and defined an template for this.
We need change small source code in function: _simpleads_render_ajax_template.

From:

if ($ad['type'] == 'graphic') {
      $result .= theme('simpleads_img_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }
    elseif ($ad['type'] == 'text') {
      $result .= theme('simpleads_text_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }
    else {
      $result .= theme('simpleads_flash_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }

To be changed

    if ($ad['type'] == 'graphic') {
      $result .= theme('simpleads_img_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }
    elseif ($ad['type'] == 'text') {
      $result .= theme('simpleads_text_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }
    else if ($ad['type'] == 'flash'){
      $result .= theme('simpleads_flash_element', array('ad' => $ad, 'settings' => $ad_setting, 'css_class' => $css_class));
    }
    else {
      $func = $ad['type'] . '_simpleads_display';
      if (function_exists($func)) {
        /// allow another module defined new ads type and render this.
        $result .= $func($ad, $ad_setting, $css_class);
      }
    }
✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡»πŸ‡³Vietnam zkday

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024