0

I have problems implementing module in drupal 7.

Whole module initially shows block with links to the five latest nodes made by current user, and in the configuration section user can change number of nodes that are shown.

I did manage to implement block that shows five latest nodes made by current user but I'm not managing to make block configuration work correctly.

First I made configuration form which looks like this:

function latest_posts_block_configure($delta = ''){
  $form = array();
  if($delta == 'latest_posts'){
    $form['latest_posts'] = array(
      '#type' => 'select',
      '#title' => t('Number of recent content items to display'),
      '#default_value' => variable_get('latest_posts', 3),
      '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10)),
    );
  )
  return $form
}

This block configuration form works fine, but I don't know how to implement hook_block_save (that should (I guess) apply options chosen in configuration form).

My idea is to take the value selected from the form and to put it into sql query that extracts nodes but since I'm drupal beginner I am still struggling with it.

Can anyone help me?

4

1 に答える 1