While creating a content or editing one, newly entered meta tags (keywords, description etc) aren't reflected when Preview of the content is made. This happens because of the following code in function nodewords_form_alter().
if (isset($type)) {
if (isset($id) && is_numeric($id)) { // tries to tags retrieve from DB; newly entered meta info not reflected
$tags = _nodewords_load($type, $id);
}
else {
$tags = array();
}
$form['nodewords'] = _nodewords_form($type, $tags);
}
I've done the following changes and it works perfectly for me. I also believe, that this method is more efficient because it doesn't hit the DB unnecessarily.
if(!empty($form_state['values']['nodewords'])) { // Check if $tags can be reused from $form_state
$tags = $form_state['values']['nodewords'];
}
elseif (isset($type)) { //Not available in $form_state. If type is set
if (isset($id) && is_numeric($id)) { // and if $id is set, load from DB
$tags = _nodewords_load($type, $id);
}
}
else {
$tags = array();
}
$form['nodewords'] = _nodewords_form($type, $tags);
Comments
Comment #1
lvshankar commentedsorry, that would be.
Comment #2
Robrecht Jacques commentedCommitted to CVS. Thanks!