Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
nao CreditAttribution: nao commentedHi, 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.
Comment #2
artatac CreditAttribution: artatac commentedHi
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
Comment #3
ferdinand.soethe CreditAttribution: ferdinand.soethe commentedReplacing the above mentioned code as follows fixed the problem for me:
foreach ($textareas as $i => $ta) {
$query .= " textareas[$i] = \"" . $ta . "\";\n";
}
Good Luck,
Ferdinand
Comment #4
ferdinand.soethe CreditAttribution: ferdinand.soethe commentedwell 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