| 1 |
<?php |
<?php |
| 2 |
/* $Id: nodewords_nodetype.module,v 1.2.2.2 2009/06/01 18:30:19 hanoii Exp $ */ |
/* $Id: nodewords_nodetype.module,v 1.2.2.3 2009/06/01 18:31:02 hanoii Exp $ */ |
| 3 |
|
|
| 4 |
function nodewords_nodetype_form_alter(&$form, &$form_state, $form_id) { |
function nodewords_nodetype_form_alter(&$form, &$form_state, $form_id) { |
| 5 |
if ($form_id == 'node_type_form' && isset($form['#node_type'])) { |
if ($form_id == 'node_type_form' && isset($form['#node_type'])) { |
| 6 |
$settings = _nodewords_get_settings(); |
$settings = _nodewords_get_settings(); |
| 7 |
$form['nodewords_nodetype'] = array( |
$form['nodewords_nodetype'] = array( |
| 8 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 9 |
'#title' => t('Meta tags node type'), |
'#title' => t('Meta tags node type'), |
| 10 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 11 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 12 |
); |
); |
| 13 |
$form['nodewords_nodetype']['nodewords_nodetype_robots'] = array( |
$form['nodewords_nodetype']['nodewords_nodetype_robots'] = array( |
| 14 |
'#type' => 'select', |
'#type' => 'select', |
| 15 |
'#title' => t('Default "robots" meta tag'), |
'#title' => t('Default "robots" meta tag'), |
| 16 |
'#options' => array( |
'#options' => array( |
| 17 |
'' => t('Use Meta tags default'), |
'' => t('Use Meta tags default'), |
| 18 |
'index,follow' => 'ALL=INDEX,FOLLOW', |
'index,follow' => 'ALL=INDEX,FOLLOW', |
| 19 |
'noindex,follow' => 'NOINDEX,FOLLOW', |
'noindex,follow' => 'NOINDEX,FOLLOW', |
| 20 |
'index,nofollow' => 'INDEX,NOFOLLOW', |
'index,nofollow' => 'INDEX,NOFOLLOW', |
| 21 |
'noindex,nofollow' => 'NONE=NOINDEX,NOFOLLOW', |
'noindex,nofollow' => 'NONE=NOINDEX,NOFOLLOW', |
| 22 |
), |
), |
| 23 |
'#multiple' => FALSE, |
'#multiple' => FALSE, |
| 24 |
'#default_value' => variable_get('nodewords_nodetype_robots_'. $form['#node_type']->type, ''), |
'#default_value' => variable_get('nodewords_nodetype_robots_'. $form['#node_type']->type, ''), |
| 25 |
'#description' => t('The ROBOTS meta tag offers a simple mechanism to indicate to web robots and crawlers wether the page should be indexed (INDEX or NOINDEX) and whether links on the page should be followed (FOLLOW or NOFOLLOW). Here you can enter the default robots meta tag to use for all pages. If unsure, select "ALL=INDEX,FOLLOW".'), |
'#description' => t('The ROBOTS meta tag offers a simple mechanism to indicate to web robots and crawlers wether the page should be indexed (INDEX or NOINDEX) and whether links on the page should be followed (FOLLOW or NOFOLLOW). Here you can enter the default robots meta tag to use for all pages. If unsure, select "ALL=INDEX,FOLLOW".'), |
| 26 |
); |
); |
| 27 |
$form['nodewords_nodetype']['nodewords_nodetype_keywords'] = array( |
$form['nodewords_nodetype']['nodewords_nodetype_keywords'] = array( |
| 28 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 29 |
'#title' => t('Default "keywords" meta tag'), |
'#title' => t('Default "keywords" meta tag'), |
| 34 |
); |
); |
| 35 |
|
|
| 36 |
$form['nodewords_nodetype']['description'] = array( |
$form['nodewords_nodetype']['description'] = array( |
| 37 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 38 |
'#title' => t('Description'), |
'#title' => t('Description'), |
| 39 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 40 |
); |
); |
| 41 |
|
|
| 42 |
$form['nodewords_nodetype']['description']['nodewords_nodetype_description'] = array( |
$form['nodewords_nodetype']['description']['nodewords_nodetype_description'] = array( |
| 43 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 47 |
); |
); |
| 48 |
|
|
| 49 |
$form['nodewords_nodetype']['nodewords_nodetype_token'] = array( |
$form['nodewords_nodetype']['nodewords_nodetype_token'] = array( |
| 50 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 51 |
'#title' => t('Token replacements'), |
'#title' => t('Token replacements'), |
| 52 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 53 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 54 |
); |
); |
| 55 |
$form['nodewords_nodetype']['nodewords_nodetype_token']['help'] = array( |
$form['nodewords_nodetype']['nodewords_nodetype_token']['help'] = array( |
| 56 |
'#type' => 'markup', |
'#type' => 'markup', |
| 57 |
'#value' => theme('token_help'), |
'#value' => theme('token_help'), |
| 58 |
); |
); |
| 59 |
|
|
| 60 |
if (user_access('allow PHP replacements')) { |
if (user_access('allow PHP replacements')) { |
| 61 |
$form['nodewords_nodetype']['description']['advanced'] = array( |
$form['nodewords_nodetype']['description']['advanced'] = array( |
| 62 |
'#type' => 'fieldset', |
'#type' => 'fieldset', |
| 63 |
'#title' => t('Advanced PHP replacement'), |
'#title' => t('Advanced PHP replacement'), |
| 64 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 65 |
'#collapsed' => TRUE, |
'#collapsed' => TRUE, |
| 66 |
); |
); |
| 67 |
$form['nodewords_nodetype']['description']['advanced']['nodewords_nodetype_desc_php'] = array( |
$form['nodewords_nodetype']['description']['advanced']['nodewords_nodetype_desc_php'] = array( |
| 68 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 69 |
'#title' => t('PHP replacement'), |
'#title' => t('PHP replacement'), |
| 70 |
'#default_value' => variable_get('nodewords_nodetype_desc_php_'. $form['#node_type']->type, ''), |
'#default_value' => variable_get('nodewords_nodetype_desc_php_'. $form['#node_type']->type, ''), |
| 71 |
'#description' => t('Code must be included within %php_tags tags. You can add any php code here to perform a particular replacement on the description meta tag information after token substitution. %description and %php_description are available to be used within this code. %title is the actual description meta tags defined above with any token replacement. Be careful if the title has single or double quotes in it. %php_description is replaced with a PHP code that defines a $description variable that you can use along your eval code with the replaced string (quotes are not a problem here). A good starting poing would be: <code>%code</code>.', array('%php_tags' => '<?php ?>', '%code' => '<?php %php_description return $description; ?>')), |
'#description' => t('Code must be included within %php_tags tags. You can add any php code here to perform a particular replacement on the description meta tag information after token substitution. %description and %php_description are available to be used within this code. %title is the actual description meta tags defined above with any token replacement. Be careful if the title has single or double quotes in it. %php_description is replaced with a PHP code that defines a $description variable that you can use along your eval code with the replaced string (quotes are not a problem here). A good starting poing would be: <code>%code</code>.', array('%php_tags' => '<?php ?>', '%code' => '<?php %php_description return $description; ?>')), |
| 72 |
); |
); |
| 73 |
} |
} |
| 74 |
} |
} |
| 75 |
} |
} |