CCK fields - digits stripped out of id
farbridges - April 23, 2009 - 09:00
| Project: | widgEditor - A WYSIWYG editor |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
When a textarea from a CCK field is added to the list of textareas on which widgEditor should be enabled, this code replaces part of the id, thus leaving the textarea rendered without widgEditor:
foreach ($textareas as $i => $ta) {
$pattern = '/(\d+)-(\w+)/i';
$replacement = 'edit-$2';
$query .= " textareas[$i] = \"" . preg_replace($pattern, $replacement, $ta) . "\";\n";
}E.g. with textarea id edit-field-abstract-0-value, the javascript added to the page contains textareas[3] = "edit-field-abstract-edit-value"; and not textareas[3] = "edit-field-abstract-0-value";.
It is not clear to me what the replacement is for. Can anybody explain it?

#1
Hi, farbridges
I think the same..
I´ve commented code lines, and run the module very good!..... I dont know why the creator´s module wanna to do that?, if on the section admin >> settings >> widgeditor you have to specified text areas ids.
#2
Hi
re
vforeach ($textareas as $i => $ta) {
$pattern = '/(\d+)-(\w+)/i';
$replacement = 'edit-$2';
$query .= " textareas[$i] = \"" . preg_replace($pattern, $replacement, $ta) . "\";\n";
}
I am trying to work out which aspect of the above I have to comment out to get a field with id
edit-field-text2-0-value
to work
thanks
#3
Replacing the above mentioned code as follows fixed the problem for me:
foreach ($textareas as $i => $ta) {
$query .= " textareas[$i] = \"" . $ta . "\";\n";
}
Good Luck,
Ferdinand
#4
well the fields shows the editor controls but on saving the page, all cck-fields were saved with "true" als the only remaining content.
any ideas?
Ferdinand