This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Flexinode: a field to manage a list

I wrote a flexinode field to easily manage a list of elements. You can choose to have an ordered or an unordered list; each element will have its own textfield.

Known issues: preview doesn't work (any idea?)

Here's the code, put it in

field_list.inc

in your flexinode directory.


<?php

function flexinode_field_list_name($field) {
return t('list');
}

function flexinode_field_list_form($field, &$node) {
$fieldname = 'flexinode_'. $field->field_id;

foreach ($node->$fieldname as $item) {
$item_fields .= form_textfield('', 'items][', $item, 60, 128);
}

$edit = $_POST['edit'];
if ($edit['items']) {
foreach ($edit['items'] as $item) {
$item_fields .= form_textfield('', 'items][', $item, 60, 128);
}
} else {
$item_fields .= form_textfield('', 'items][', '', 60, 128);
$item_fields .= form_textfield('', 'items][', '', 60, 128);
$item_fields .= form_textfield('', 'items][', '', 60, 128);
}
if($_POST['more']) {
$item_fields .= form_textfield('', 'items][', '', 60, 128);
$item_fields .= form_textfield('', 'items][', '', 60, 128);
$item_fields .= form_textfield('', 'items][', '', 60, 128);
}
$item_fields .= form_button(t('More fields'), 'more');

return form_group(t($field->label), $item_fields);
}

function flexinode_field_list_db_select($field) {
$fieldname = 'flexinode_'. $field->field_id;

Google SiteMap - which to choose?

Hello,

I'm very happy that Drupal is so quickly responding for new possibilities. The Google SiteMaps is very exciting possibility to increase number of visits.

But I can find to such modules on Drupal site.

1. Google Sitemap module by SamAMac
http://drupal.org/node/26133

Validating settings before they get saved

I need an extra password widget in a module, and have run into a snag.

I've implemented hook_settings. The behavior I want is to check if the password and the confirm password fields don't match, I want the usual sort of "Passwords Must Match" error message to appear.

The problem is that system.module saves my password settings very early in the request processing. I can't use hook_validate because it won't get called for the _settings page. I can't do the validation in hook_settings because the system steps in long before that.

What's the recommended way to deal with this. I have a solution that works, but it's so fragile that it's pretty much guaranteed to get broken the next time system.module changes:

if(isset($_POST['edit']['my_password'])){
//looks like we are setting the site password.
//make sure the copies match so we do not get locked out.
$pw = $_POST['edit']['my_password'];
$pw_confirm = $_POST['edit']['my_password_confirm'];
if($pw != $pw_confirm){
form_set_error('my_password', t('Passwords must match!'));
//and we must unset some globals to fool the systems settings
//gremlin. TO DO: This is hinkey, and may break.
unset($_POST['edit']['my_password']);
unset($_POST['edit']['my_password_confirm']);
if($_POST['op'] == t('Save configuration')){
$_POST['op'] .= "--mod"; //to fool system.module

Whiteboard like module

i've been looking for quite some time for a whiteboard module (for any cms), but have had no luck. does anyone know of one? or where to begin to develop one?

Chatbox langue problems

When i rewrite the module so the langue will fit.. All Swedish Å Ä Ö turns to sick characthers like boxes and stuff, Like this �. How do i solve this

And i rewrote a .po file that was included to, but i how do i add the .po file to chatbox?

/Coral

Chatbox problems

I have installed Chatbox by installing the tabels into my Mysql database and installed the module.. But where do the chatbox appear to users and how do i get it appear to users?

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions