It would be fantastic, if the Slide Ad area would added as an additional theme-block.
Any block provided by modules would be placeable in this Slide Ad-block.

Micha

CommentFileSizeAuthor
#1 slidead-block_target-1503976.patch2.82 KBmigmedia

Comments

migmedia’s picture

Version: » 7.x-1.x-dev
Component: User interface » Code
Status: Active » Patch (to be ported)
StatusFileSize
new2.82 KB

I have started to implement slidead as a block-target.

soncco’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

Thank you @migmedia!

This works perfect! I'm working for port the existing content in a block.

soncco’s picture

Status: Reviewed & tested by the community » Fixed

Commited in 7.x-1.x :)

soncco’s picture

Status: Fixed » Closed (fixed)
soncco’s picture

Status: Closed (fixed) » Needs review
Issue tags: +Needs tests

I'm trying to create update function for move slidead_content and slidead_title in a new block

This is the function:

/**
 * Let Slide Ad be used as block-target.
 */
function slidead_update_7001() {
  // Clearing cache registry.
  cache_clear_all();

  // Creating the block.
  $title = variable_get('slidead_title', t('Welcome to my Site'));
  $content = variable_get('slidead_content', array('value' => t('Welcome text'), 'format' => NULL));
  $format = isset($content['format']) ? $content['format'] : filter_default_format();

  $delta = db_insert('block_custom')
    ->fields(array(
      'body' => $content['value'],
      'info' => t('Slide Ad Content'),
      'format' => $format,
    ))
    ->execute();
  
  foreach (list_themes() as $key => $theme) {
    if ($theme->status) {
      $insert_id = db_insert('block')
        ->fields(array(
          'module' => 'block',
          'delta' => $delta,
          'theme' => $theme->name,
          'status' => 1,
          'region' => 'slidead',
          'pages' => '',
          'title' => $title,
          'cache' => DRUPAL_NO_CACHE,
        ))
        ->execute();
    }
  }

  drupal_set_message(t('The Slide Ad block has been created.'));

  // Cleaning.
  variable_del('slidead_title');
  variable_del('slidead_content');
}

Works fine, except in the block table, the fields title, region are not updated.

+-----+----------+-------------+--------+--------+--------+--------------------+--------+------------+-------+-------+-------+
| bid | module   | delta       | theme  | status | weight | region             | custom | visibility | pages | title | cache |
+-----+----------+-------------+--------+--------+--------+--------------------+--------+------------+-------+-------+-------+
|  37 | block    | 1           | bartik |      0 |      0 | -1                 |      0 |          0 |       |       |    -1 |
|  38 | block    | 1           | seven  |      0 |      0 | -1                 |      0 |          0 |       |       |    -1 |

What's wrong? :/

soncco’s picture

Issue summary: View changes
Status: Needs review » Fixed
Issue tags: -Needs tests

Changes released on 7.x-1.1.

soncco’s picture

Status: Fixed » Closed (fixed)