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?

Comments

nao’s picture

Priority: Normal » Minor

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.

artatac’s picture

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

ferdinand.soethe’s picture

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

ferdinand.soethe’s picture

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