When you create node you may see "Publishing options" which include :

Published
Promoted to front page
Sticky at top of lists

I need to add "Front Page Slideshow", "Taxonomy Slideshow", If slideshow selected then will show in the frontpage slideshow, else will show in the taxonomy slideshow. ... via Views2

Thx in advanced!

Comments

adam_b’s picture

I don't know of a way of extending the Publishing options list, but you could do this by creating another taxonomy and using that in Views2.

marvix’s picture

thx ..

Done by CCK check box & views 2

As If’s picture

Actually getting the option onto the form is very simple in Drupal 6. In a custom module, you can do this:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'my_content_type_form') {
    $form['options']['super_special'] = array(
      '#type' => 'checkbox',
      '#title' => t('This is a Super Special Magic Node'),
      '#default_value' => 0,
    );
  }
}

But of course, this data won't be held anywhere after you submit it, so you will also need to build a way to capture it and store it somewhere. For instance, in a CCK field. To capture it, you can do this:

function mymodule_nodeapi(&$node, $op) {
  switch($op) {
    case 'presave' :
      if($node->type == 'my_content_type') {
        $node->field_super_special = array(
          array('value' => $node->super_special),
        );
      }
      break;
  }
}

Then to catch it and set the checkbox the next time the form gets edited, we need to make a few modifications to form_alter. Here is the finished version:

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'my_content_type_form') {
    $x = node_load(arg(1));
    $specialvalue = $x->field_super_special[0]['value'];
    $form['options']['super_special'] = array(
      '#type' => 'checkbox',
      '#title' => t('This is a Super Special Magic Node'),
      '#default_value' => $specialvalue,
    );
  }
}

If you do this, you will probably want to suppress the display of the real CCK field, either by using the content_permissions module or adding more lines to form_alter, or just use CSS (display: none;).

Alternately, you could save the data in a table of your own, as long as you pull it back up when you load the form again (again, this would be in form_alter).

Obviously the details will differ for every site, but this should be enough to get you started.

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

ellanylea’s picture

mxt’s picture