I'd like to change a Flexinode Title Label (From Title to Event Number) Just wondering if this is possible and if so how? I assume the flexinode module code needs to be changed, I'm just not sure where.

Also on a rather more complex note: Is it possle to auto assign (and auto increment) a Flexinode Title each time a new Flexinode page is created? i.e I'd like to auto assign to the title the year followed by an auto assigned concurrent number. e.g 200601, 200602 etc.

Any help much apprecited

Comments

Squidgy’s picture

What you're looking for lurks in flexinode.module somewhere around line 580 - right where it says '#title' => t('Title'), change that. If you do rig it up so that the title is based on the node year, etc., let me know - could be handy knowledge.


This is what I have lurking in mine - I changed my title to 'upload title' since it's a purely file-based site.

  $form['title'] = array(
    '#type' => 'textfield',
    '#title' => t('Upload Title'),
    '#default_value' => $node->title,
    '#size' => 60,
    '#maxlength' => 128,
    '#required' => TRUE,
    );
heckp’s picture

I think it's rather '#default_value' => $node->title that should be changed if I understood the problem right.
You could set it to '#default_value' => time() for example to get the current unix timestamp as default title.

Squidgy’s picture

A better solution all round is this minimodule - create a file in the modules directory called filetitle_populate.module, and fill it with:

function filetitle_populate_form_alter($form_id, & $form) {
       //Is it a flexinode of the right type? Change 'flexinode-4' to flexinode-yournumberhere. 
	if (isset ($form['type']) && $form['type']['#value'] === 'flexinode-4' && $form['type']['#value'] . '_node_form' == $form_id) {
	global $user;
          //Set default value to the user name and date of submission.
            $form['flexinode_30']['#default_value'] =  $user->name .  " " . date('d/m/Y');
            $form['flexinode_30']['#type'] = 'hidden';
            //This next line, for me, makes a hidden "Thank you for uploading" div appear over the current window. Check out http://getelementbyid.com/scripts/index.aspx?CodeID=5 for the same code.
            //$form['submit']['#attributes'] = array('onClick' => 'ShowHide(\'lyr1\',\'visible\')', 'id' => 'replacement-2');
            
      //uncomment the next line to see a list of all your current fields to identity which one is the title, or which one you want to populate.
      //print_r($form);
}
}
Dash’s picture

I added this to template.php:

<?php
function flexinode_form_alter($form_id, & $form) {
    if (isset ($form['type']) && $form['type']['#value'] === 'flexinode-4' && $form['type']['#value'] . '_node_form' == $form_id) {
    global $user;
    // Set default value of the title.
    $form['title']['#default_value'] =  t('Today\'s Music);
}
?>

Which works, although I'm sure I should probably move the code to a tpl.php file...

Skip The Budgie