Closed (fixed)
Project:
Nodewords: D6 Meta Tags
Version:
6.x-1.0-rc1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2009 at 09:17 UTC
Updated:
20 Feb 2009 at 13:20 UTC
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!