Removed obsolete $ in source files
This commit is contained in:
parent
a39c010e06
commit
e5f2b64d98
146 changed files with 836 additions and 1081 deletions
|
@ -1,7 +1,6 @@
|
|||
; $Id: content_taxonomy.info,v 1.1.2.2.2.1 2008/04/30 08:05:19 mh86 Exp $
|
||||
name = Content Taxonomy
|
||||
description = Defines a field type for taxonomy terms
|
||||
dependencies[] = content
|
||||
dependencies[] = content
|
||||
dependencies[] = taxonomy
|
||||
package = CCK
|
||||
core = 6.x
|
||||
|
@ -12,4 +11,3 @@ version = "6.x-1.0-rc2"
|
|||
core = "6.x"
|
||||
project = "content_taxonomy"
|
||||
datestamp = "1250688034"
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
// $Id: $
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
|
@ -41,16 +38,16 @@ function content_taxonomy_disable() {
|
|||
|
||||
/**
|
||||
* Implemenation of hook_update_N().
|
||||
*
|
||||
*
|
||||
* updates existing fields from 5.x to 6.x
|
||||
*/
|
||||
function content_taxonomy_update_6000() {
|
||||
if ($abort = content_check_update('content_taxonomy')) {
|
||||
return $abort;
|
||||
}
|
||||
|
||||
|
||||
drupal_load('module', 'content');
|
||||
|
||||
|
||||
$ret = array();
|
||||
|
||||
// Get the latest cache values and schema.
|
||||
|
@ -65,7 +62,7 @@ function content_taxonomy_update_6000() {
|
|||
case 'content_taxonomy':
|
||||
$db_info = content_database_info($field);
|
||||
$table = $db_info['table'];
|
||||
|
||||
|
||||
//fix old settings first and map them to the new ones.
|
||||
$result = db_query("SELECT * FROM {". content_field_tablename() ."} WHERE type = 'content_taxonomy' AND field_name = '%s'", $field['field_name']);
|
||||
while ($field = db_fetch_array($result)) {
|
||||
|
@ -76,7 +73,7 @@ function content_taxonomy_update_6000() {
|
|||
$field['type_name'] = $type_name;
|
||||
$field['columns'] = $db_info['columns'];
|
||||
content_alter_schema(array(), $field);
|
||||
|
||||
|
||||
$sql_nodes = db_query("SELECT * FROM {node} WHERE type = '%s'", $type_name);
|
||||
while ($node = db_fetch_object($sql_nodes)) {
|
||||
$tids = content_taxonomy_install_terms_by_field($node, $field_settings);
|
||||
|
@ -104,8 +101,8 @@ function content_taxonomy_update_6000() {
|
|||
}
|
||||
unset($field_settings['save']);
|
||||
$field_settings['hide_taxonomy_fields'] = isset($field_settings['hide_taxonomy_fields']) ? $field_settings['hide_taxonomy_fields'] : TRUE;
|
||||
$field_settings['parent'] = $field_settings['tid'];
|
||||
|
||||
$field_settings['parent'] = $field_settings['tid'];
|
||||
|
||||
$field['global_settings'] = array();
|
||||
$setting_names = module_invoke($field['module'], 'field_settings', 'save', $field);
|
||||
if (is_array($setting_names)) {
|
||||
|
@ -117,7 +114,7 @@ function content_taxonomy_update_6000() {
|
|||
$field['db_columns'] = $field['columns'];
|
||||
drupal_write_record(content_field_tablename(), $field, 'field_name');
|
||||
}
|
||||
|
||||
|
||||
foreach ($db_info['columns'] as $column => $attributes) {
|
||||
$attributes['not null'] = FALSE;
|
||||
$column = $attributes['column'];
|
||||
|
@ -139,7 +136,7 @@ function content_taxonomy_update_6000() {
|
|||
|
||||
/**
|
||||
* Implemenation of hook_update_N().
|
||||
*
|
||||
*
|
||||
* Renaming of the Parent setting
|
||||
*/
|
||||
function content_taxonomy_update_6001() {
|
||||
|
@ -167,7 +164,7 @@ function content_taxonomy_update_6001() {
|
|||
|
||||
/**
|
||||
* Implemenation of hook_update_N().
|
||||
*
|
||||
*
|
||||
* Fixing parent setting
|
||||
*/
|
||||
function content_taxonomy_update_6002() {
|
||||
|
@ -194,17 +191,17 @@ function content_taxonomy_install_terms_by_field($node, $field) {
|
|||
$result = db_query("SELECT n.tid FROM {term_hierarchy} h, {term_node} n, {term_data} td WHERE
|
||||
n.nid = %d AND n.tid = h.tid AND h.parent = %d AND td.tid=n.tid AND td.vid=%d",
|
||||
$node->nid, $field['tid'], $field['vid']);
|
||||
|
||||
|
||||
while ($data = db_fetch_array($result)) {
|
||||
$terms[$data["tid"]] = $data["tid"];
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
$result = taxonomy_node_get_terms_by_vocabulary($node, $field['vid']);
|
||||
foreach ($result as $tid => $term) {
|
||||
$terms[$tid] = $tid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $terms;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
|
||||
// $Id: content_taxonomy.module,v 1.2.2.15.2.33 2009/08/19 12:45:58 mh86 Exp $
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Defines a field type for referencing a taxonomy term.
|
||||
|
@ -63,20 +60,20 @@ function content_taxonomy_field_settings($op, $field) {
|
|||
switch ($op) {
|
||||
case 'form':
|
||||
$form = array();
|
||||
|
||||
|
||||
$form['save_term_node'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Save values additionally to the core taxonomy system (into the \'term_node\' table).'),
|
||||
'#default_value' => is_numeric($field['save_term_node']) ? $field['save_term_node'] : 0,
|
||||
'#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'),
|
||||
'#description' => t('If this option is set, saving of terms is additionally handled by the taxonomy module. So saved terms from Content Taxonomy fields will appear as any other terms saved by the core taxonomy module. Set this option if you are using any other taxonomy application, like tagadelic. Otherwise terms are only saved in the cck tables and can only be accessed via the node or a view'),
|
||||
);
|
||||
|
||||
|
||||
$options_voc = array();
|
||||
foreach (taxonomy_get_vocabularies() as $voc) {
|
||||
_content_taxonomy_localize_vocabulary($voc);
|
||||
$options_voc[$voc->vid] = $voc->name;
|
||||
}
|
||||
|
||||
|
||||
$form['vid'] = array(
|
||||
'#title' => t('Vocabulary'),
|
||||
'#type' => 'select',
|
||||
|
@ -84,13 +81,13 @@ function content_taxonomy_field_settings($op, $field) {
|
|||
'#options' => $options_voc,
|
||||
'#description' => t('Terms of the selected vocabulary get exposed to the field'),
|
||||
);
|
||||
|
||||
|
||||
$form['hierarchical_vocabulary'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Advanced settings for hierarchical vocabularies'),
|
||||
'#collapsible' => TRUE,
|
||||
);
|
||||
|
||||
|
||||
$form['hierarchical_vocabulary']['parent'] = array(
|
||||
'#title' => t('Parent Term'),
|
||||
'#type' => 'select',
|
||||
|
@ -118,22 +115,22 @@ function content_taxonomy_field_settings($op, $field) {
|
|||
'#default_value' => is_numeric($field['depth']) ? $field['depth'] : '',
|
||||
'#description' => t('By setting a numeric value, the depth of the hierarchy shown can be limited. Leave this field blank to show the whole hierarchy.'),
|
||||
);
|
||||
|
||||
|
||||
return $form;
|
||||
|
||||
|
||||
|
||||
return $form;
|
||||
|
||||
case 'save':
|
||||
return array('save_term_node', 'vid', 'parent', 'parent_php_code', 'depth');
|
||||
|
||||
|
||||
case 'database columns':
|
||||
return array(
|
||||
'value' => array('type' => 'int', 'not null' => FALSE, 'sortable' => FALSE),
|
||||
);
|
||||
|
||||
|
||||
case 'views data':
|
||||
$data = content_views_field_views_data($field);
|
||||
$table_alias = content_views_tablename($field);
|
||||
|
||||
|
||||
// Add a relation to the taxonomy term table.
|
||||
$data[$table_alias][$field['field_name'] .'_value']['relationship'] = array(
|
||||
'handler' => 'views_handler_relationship',
|
||||
|
@ -152,7 +149,7 @@ function content_taxonomy_field_settings($op, $field) {
|
|||
* Implementation of hook_field().
|
||||
*/
|
||||
function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
|
||||
switch ($op) {
|
||||
switch ($op) {
|
||||
case 'presave':
|
||||
if ($field['save_term_node']) {
|
||||
static $_content_taxonomy_array_cleared;
|
||||
|
@ -160,10 +157,10 @@ function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
|
|||
_content_taxonomy_taxonomy_unset($node->taxonomy, array($field['vid']));
|
||||
$_content_taxonomy_array_cleared[$node->nid][$field['vid']] = TRUE;
|
||||
}
|
||||
|
||||
|
||||
foreach ($items as $key => $entry) {
|
||||
if ($entry['value']) {
|
||||
if (is_object($node->taxonomy[$entry['value']])
|
||||
if (is_object($node->taxonomy[$entry['value']])
|
||||
|| (is_array($node->taxonomy) && in_array($entry['value'], $node->taxonomy))
|
||||
|| (isset($entry['_remove']) && $entry['_remove'] == 1)) {
|
||||
continue;
|
||||
|
@ -182,7 +179,7 @@ function content_taxonomy_field($op, &$node, $field, &$items, $teaser, $page) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// the $node->taxonomy array should never be empty, because in this case the
|
||||
// the $node->taxonomy array should never be empty, because in this case the
|
||||
// taxonomy nodeapi doesn't call taxonomy_node_save which handles removing
|
||||
// and inserting of terms
|
||||
if (empty($node->taxonomy)) {
|
||||
|
@ -251,16 +248,16 @@ function content_taxonomy_content_is_empty($item, $field) {
|
|||
*/
|
||||
function content_taxonomy_allowed_values($field) {
|
||||
$options = array();
|
||||
|
||||
|
||||
//for opt groups call different function
|
||||
if (isset($field['widget']['group_parent']) && $field['widget']['group_parent'] > 0) {
|
||||
return content_taxonomy_allowed_values_groups($field);
|
||||
}
|
||||
|
||||
|
||||
$depth = (is_numeric($field['depth'])) ? $field['depth'] : NULL;
|
||||
|
||||
$tree = taxonomy_get_tree($field['vid'], content_taxonomy_field_get_parent($field), -1, $depth);
|
||||
|
||||
|
||||
if (is_array($tree)) {
|
||||
foreach ($tree as $term) {
|
||||
_content_taxonomy_localize_term($term);
|
||||
|
@ -280,14 +277,14 @@ function content_taxonomy_allowed_values($field) {
|
|||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Creating Opt Groups for content_taxonomy_options
|
||||
*/
|
||||
function content_taxonomy_allowed_values_groups($field) {
|
||||
$options = array();
|
||||
$parent = content_taxonomy_field_get_parent($field);
|
||||
$group_parent = $field['widget']['group_parent'];
|
||||
|
||||
|
||||
//if children in no group
|
||||
$default_terms = taxonomy_get_children($parent, $field['vid']);
|
||||
foreach ($default_terms as $default_term) {
|
||||
|
@ -345,13 +342,13 @@ function content_taxonomy_form_alter(&$form, $form_state, $form_id) {
|
|||
}
|
||||
}
|
||||
_content_taxonomy_taxonomy_unset($form['taxonomy'], $_content_taxonomy_vids);
|
||||
|
||||
|
||||
//hide empty 'Vocabularies' fieldsets
|
||||
$empty_fieldset = TRUE;
|
||||
if (is_array($form['taxonomy'])) {
|
||||
foreach ($form['taxonomy'] as $key => $value) {
|
||||
if (is_array($value) && !empty($value)) {
|
||||
$empty_fieldset = FALSE;
|
||||
$empty_fieldset = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +420,7 @@ function content_taxonomy_views_api() {
|
|||
*/
|
||||
function content_taxonomy_fields() {
|
||||
static $ct_fields;
|
||||
|
||||
|
||||
if (!is_array($ct_fields)) {
|
||||
$ct_fields = array();
|
||||
foreach (content_types() as $type_name => $type) {
|
||||
|
@ -438,7 +435,7 @@ function content_taxonomy_fields() {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Helper functions that returns all terms group by their vocabulary
|
||||
*
|
||||
* needed for some settings forms
|
||||
|
@ -452,7 +449,7 @@ function _content_taxonomy_get_all_terms() {
|
|||
_content_taxonomy_localize_term($term);
|
||||
$options[$voc->name][$term->tid] = str_repeat('- ', $term->depth) . $term->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
@ -489,7 +486,7 @@ function _content_taxonomy_localize_vocabulary(&$vocabulary) {
|
|||
|
||||
/**
|
||||
* carefully unsets node or node form taxonomy items
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param $form the node or node form's taxonomy selections. nodes are objects and forms are arrays, so only the actual taxonomy value or property is passed
|
||||
* @param $vids an array containing a list of vocabulary IDs whose terms should be unset
|
||||
|
@ -533,7 +530,7 @@ function content_taxonomy_content_diff_values($node, $field, $items) {
|
|||
foreach ($items as $item) {
|
||||
if (isset($item['value']) && is_numeric($item['value'])) {
|
||||
$term = taxonomy_get_term($item['value']);
|
||||
$return[] = $term->name;
|
||||
$return[] = $term->name;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
; $Id: content_taxonomy_autocomplete.info,v 1.1.2.4.2.1 2008/04/30 08:05:19 mh86 Exp $
|
||||
name = Content Taxonomy Autocomplete
|
||||
description = Defines a autocomplete widget type for content_taxonomy
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = taxonomy
|
||||
package = CCK
|
||||
core = 6.x
|
||||
|
@ -12,4 +11,3 @@ version = "6.x-1.0-rc2"
|
|||
core = "6.x"
|
||||
project = "content_taxonomy"
|
||||
datestamp = "1250688034"
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// $Id: content_taxonomy_autocomplete.install,v 1.1.2.2 2008/12/17 21:31:07 mh86 Exp $
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// $Id: content_taxonomy_autocomplete.module,v 1.2.2.4.2.17 2009/08/19 09:42:30 mh86 Exp $
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Defines a widget type for content_taxonomy with autocomplete
|
||||
|
@ -69,16 +67,16 @@ function content_taxonomy_autocomplete_widget_settings($op, $widget) {
|
|||
),
|
||||
);
|
||||
$form['autocomplete']['extra_parent'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Extra Parent for new terms'),
|
||||
'#options' => _content_taxonomy_get_all_terms(),
|
||||
'#type' => 'select',
|
||||
'#title' => t('Extra Parent for new terms'),
|
||||
'#options' => _content_taxonomy_get_all_terms(),
|
||||
'#default_value' => (isset($widget['extra_parent']) && is_numeric($widget['extra_parent'])) ? $widget['extra_parent'] : 0,
|
||||
'#description' => t('This setting is only relevant if you have selected "Allow and insert new terms by the user into the vocabulary". If you select any term here, new terms will get children of the selected one, otherwise new terms get children of the parent term (root, if no parent selected) selected in the global settings.'),
|
||||
);
|
||||
|
||||
|
||||
$form['autocomplete']['maxlength'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Maximum length of autocomplete'),
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Maximum length of autocomplete'),
|
||||
'#default_value' => (isset($widget['maxlength']) && is_numeric($widget['maxlength'])) ? $widget['maxlength'] : 255,
|
||||
'#element_validate' => array('_content_taxonomy_autocomplete_widget_settings_maxlength_validate'),
|
||||
'#required' => TRUE,
|
||||
|
@ -86,8 +84,8 @@ function content_taxonomy_autocomplete_widget_settings($op, $widget) {
|
|||
);
|
||||
if (module_exists('active_tags')) {
|
||||
$form['autocomplete']['active_tags'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Use Active Tags style widget'),
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Use Active Tags style widget'),
|
||||
'#default_value' => isset($widget['active_tags']) ? $widget['active_tags'] : 0,
|
||||
'#description' => t('Use the Active Tags module to improve the usability of this autocomplete widget.'),
|
||||
);
|
||||
|
@ -122,7 +120,7 @@ function content_taxonomy_autocomplete_elements() {
|
|||
return array(
|
||||
'content_taxonomy_autocomplete' => array(
|
||||
'#input' => TRUE,
|
||||
'#columns' => array('value'),
|
||||
'#columns' => array('value'),
|
||||
'#delta' => 0,
|
||||
'#process' => array('content_taxonomy_autocomplete_process'),
|
||||
'#autocomplete_path' => FALSE,
|
||||
|
@ -173,7 +171,7 @@ function content_taxonomy_autocomplete_process($element, $edit, $form_state, $fo
|
|||
$field_name = $element['#field_name'];
|
||||
$field = $form['#field_info'][$field_name];
|
||||
$field_key = $element['#columns'][0];
|
||||
|
||||
|
||||
$element[$field_key] = array(
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : '',
|
||||
|
@ -187,16 +185,16 @@ function content_taxonomy_autocomplete_process($element, $edit, $form_state, $fo
|
|||
'#columns' => $element['#columns'],
|
||||
'#maxlength' => !empty($field['widget']['maxlength']) ? $field['widget']['maxlength'] : 255,
|
||||
);
|
||||
|
||||
|
||||
if (empty($element[$field_key]['#element_validate'])) {
|
||||
$element[$field_key]['#element_validate'] = array();
|
||||
}
|
||||
array_unshift($element[$field_key]['#element_validate'], 'content_taxonomy_autocomplete_validate');
|
||||
|
||||
|
||||
if (module_exists('active_tags') && $field['widget']['active_tags']) {
|
||||
active_tags_enable_widget('#' . $element['#id'] . '-value-wrapper');
|
||||
}
|
||||
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
|
@ -209,16 +207,16 @@ function content_taxonomy_autocomplete_validate($element, &$form_state) {
|
|||
$field_name = $element['#field_name'];
|
||||
$field = content_fields($field_name, $element['#type_name']);
|
||||
$field_key = $element['#columns'][0];
|
||||
|
||||
|
||||
//if the element parents array contains the field key, we have to remove it
|
||||
//because otherwise form_set_value won't work. (still the question why is it in)
|
||||
if ($element['#parents'][count($element['#parents'])-1] == $field_key) {
|
||||
array_pop($element['#parents']);
|
||||
array_pop($element['#array_parents']);
|
||||
}
|
||||
|
||||
|
||||
$value = $element['#value'];
|
||||
|
||||
|
||||
$extracted_ids = content_taxonomy_autocomplete_tags_get_tids($value, $field['vid'], content_taxonomy_field_get_parent($field), $field['widget']['extra_parent']);
|
||||
|
||||
if (!$field['multiple'] && count(content_taxonomy_autocomplete_split_tags($value, $field['vid'])) > 1) {
|
||||
|
@ -234,7 +232,7 @@ function content_taxonomy_autocomplete_validate($element, &$form_state) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$values = content_taxonomy_autocomplete_form2data($extracted_ids, $field, $element);
|
||||
form_set_value($element, $values, $form_state);
|
||||
}
|
||||
|
@ -249,9 +247,9 @@ function content_taxonomy_autocomplete_form2data($extracted_ids, $field, $elemen
|
|||
if (is_array($extracted_ids['non_existing_terms'])) {
|
||||
if ($field['widget']['extra_parent']) {
|
||||
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], $field['widget']['extra_parent']);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], content_taxonomy_field_get_parent($field));
|
||||
$new_tids = content_taxonomy_autocomplete_insert_tags($extracted_ids['non_existing_terms'], content_taxonomy_field_get_parent($field));
|
||||
}
|
||||
}
|
||||
return content_transpose_array_rows_cols(array($element['#columns'][0] => array_merge($existing_tids, $new_tids)));
|
||||
|
@ -261,7 +259,7 @@ function content_taxonomy_autocomplete_form2data($extracted_ids, $field, $elemen
|
|||
|
||||
/**
|
||||
* Retrieve a pipe delimited string of autocomplete suggestions
|
||||
*
|
||||
*
|
||||
* @param String Fieldname
|
||||
* @param Integer TID of a parent (optional)
|
||||
* @param BOOLEAN whether a multiple field or not
|
||||
|
@ -274,13 +272,13 @@ function content_taxonomy_autocomplete_load($field_name, $string = '') {
|
|||
$content_type_info = _content_type_info();
|
||||
$vid = $content_type_info['fields'][$field_name]['vid'];
|
||||
$tid = content_taxonomy_field_get_parent($content_type_info['fields'][$field_name]);
|
||||
|
||||
|
||||
// If the menu system has splitted the search text because of slashes, glue it back.
|
||||
if (func_num_args() > 2) {
|
||||
$args = func_get_args();
|
||||
$string .= '/'. implode('/', array_slice($args, 2));
|
||||
}
|
||||
|
||||
|
||||
// The user enters a comma-separated list of tags. We only autocomplete the last tag.
|
||||
$array = drupal_explode_tags($string);
|
||||
|
||||
|
@ -289,17 +287,17 @@ function content_taxonomy_autocomplete_load($field_name, $string = '') {
|
|||
$matches = array();
|
||||
if ($last_string != '') {
|
||||
if ($tid) {
|
||||
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
|
||||
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
|
||||
LEFT JOIN {term_synonym} s ON t.tid = s.tid
|
||||
INNER JOIN {term_hierarchy} h ON t.tid = h.tid
|
||||
WHERE h.parent = %d
|
||||
WHERE h.parent = %d
|
||||
AND (LOWER(t.name) LIKE LOWER('%%%s%%') OR LOWER(s.name) LIKE LOWER('%%%s%%'))", 't', 'tid'),
|
||||
$tid,$last_string,$last_string,0,10);
|
||||
}
|
||||
else {
|
||||
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
|
||||
$result = db_query_range(db_rewrite_sql("SELECT t.name FROM {term_data} t
|
||||
LEFT JOIN {term_synonym} s ON t.tid = s.tid
|
||||
WHERE t.vid = %d
|
||||
WHERE t.vid = %d
|
||||
AND (LOWER(t.name) LIKE LOWER('%%%s%%') OR LOWER(s.name) LIKE LOWER('%%%s%%'))", 't', 'tid'),
|
||||
$vid, $last_string, $last_string, 0, 10);
|
||||
}
|
||||
|
@ -335,7 +333,7 @@ function content_taxonomy_autocomplete_tags_get_tids($typed_input, $vid, $parent
|
|||
// formatting so to save the term into the DB as the user intends.
|
||||
$typed_term = trim(str_replace('""', '"', preg_replace('/^"(.*)"$/', '\1', $typed_term)));
|
||||
if ($typed_term == "") { continue; }
|
||||
|
||||
|
||||
// See if the term exists in the chosen vocabulary
|
||||
// and return the tid, otherwise, add a new record.
|
||||
$possibilities = taxonomy_get_term_by_name($typed_term);
|
||||
|
@ -348,7 +346,7 @@ function content_taxonomy_autocomplete_tags_get_tids($typed_input, $vid, $parent
|
|||
$parents = taxonomy_get_parents($possibility->tid);
|
||||
if (in_array($parent, array_keys($parents)) || in_array($extra_parent, array_keys($parents))) {
|
||||
$result['existing_tids'][$possibility->tid] = $possibility->tid;
|
||||
$typed_term_tid = $possibility->tid;
|
||||
$typed_term_tid = $possibility->tid;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
; $Id: content_taxonomy_options.info,v 1.1.2.5.2.1 2008/04/30 08:05:19 mh86 Exp $
|
||||
name = Content Taxonomy Options
|
||||
description = Defines a option widget type for content_taxonomy for selects, radios/checkboxes
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = taxonomy
|
||||
dependencies[] = optionwidgets
|
||||
package = CCK
|
||||
|
@ -14,4 +13,3 @@ version = "6.x-1.0-rc2"
|
|||
core = "6.x"
|
||||
project = "content_taxonomy"
|
||||
datestamp = "1250688034"
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
// $Id: content_taxonomy_options.install,v 1.1.2.2 2008/12/17 21:31:07 mh86 Exp $
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
|
||||
// $Id: content_taxonomy_options.module,v 1.1.4.7.2.4 2008/12/27 11:25:27 mh86 Exp $
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Defines a widget type for content_taxonomy for options
|
||||
|
@ -56,7 +53,7 @@ function content_taxonomy_options_widget_settings($op, $widget) {
|
|||
'#weight' => 10,
|
||||
);
|
||||
$form['settings']['show_depth'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Indent child terms with \' - \' signs'),
|
||||
'#default_value' => is_numeric($widget['show_depth']) ? $widget['show_depth'] : 1,
|
||||
'#description' => t('If this option is checked, a hierarchy gets visualized by indenting child terms, otherwise it\'s a flat list'),
|
||||
|
@ -69,7 +66,7 @@ function content_taxonomy_options_widget_settings($op, $widget) {
|
|||
'#description' => t('This settings applies only for select fields. Select a parent term containg the grouping terms. Grouping terms should be parents of the selected terms (from the Global Settings).'),
|
||||
);
|
||||
return $form;
|
||||
|
||||
|
||||
case 'save':
|
||||
return array('group_parent', 'show_depth');
|
||||
}
|
||||
|
@ -80,7 +77,7 @@ function content_taxonomy_options_widget_settings($op, $widget) {
|
|||
*/
|
||||
function content_taxonomy_options_widget(&$form, &$form_state, $field, $items, $delta = NULL) {
|
||||
$element = array(
|
||||
'#type' => ($field['widget']['type'] == 'content_taxonomy_select') ? 'optionwidgets_select' : 'optionwidgets_buttons',
|
||||
'#type' => ($field['widget']['type'] == 'content_taxonomy_select') ? 'optionwidgets_select' : 'optionwidgets_buttons',
|
||||
'#default_value' => !empty($items) ? $items : array(),
|
||||
);
|
||||
return $element;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
; $Id: content_taxonomy_tree.info,v 1.1.2.1 2008/04/30 08:05:19 mh86 Exp $
|
||||
name = Content Taxonomy Tree
|
||||
description = Defines a dynamic tree widget for Content Taxonomy
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = content
|
||||
dependencies[] = content_taxonomy
|
||||
dependencies[] = taxonomy
|
||||
dependencies[] = taxonomy_manager
|
||||
package = CCK
|
||||
|
@ -13,4 +12,3 @@ version = "6.x-1.0-rc2"
|
|||
core = "6.x"
|
||||
project = "content_taxonomy"
|
||||
datestamp = "1250688034"
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
<?php
|
||||
// $Id: content_taxonomy_tree.install,v 1.1.2.2 2008/12/17 21:31:07 mh86 Exp $
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
<?php
|
||||
|
||||
// $Id: content_taxonomy_tree.module,v 1.1.2.5 2009/05/14 16:58:22 mh86 Exp $
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of hook_theme().
|
||||
*/
|
||||
|
@ -45,7 +40,7 @@ function content_taxonomy_tree_widget_settings($op, $widget) {
|
|||
'#weight' => 10,
|
||||
);
|
||||
$form['settings']['expand_all'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Expand whole tree by default'),
|
||||
'#default_value' => isset($widget['expand_all']) ? $widget['expand_all'] : 0,
|
||||
'#description' => t('Otherwise only branches, where a term is selected get expanded by default'),
|
||||
|
@ -64,7 +59,7 @@ function content_taxonomy_tree_elements() {
|
|||
return array(
|
||||
'content_taxonomy_tree' => array(
|
||||
'#input' => TRUE,
|
||||
'#columns' => array('value'),
|
||||
'#columns' => array('value'),
|
||||
'#delta' => 0,
|
||||
'#process' => array('content_taxonomy_tree_process'),
|
||||
'#element_validate' => array('content_taxonomy_tree_validate'),
|
||||
|
@ -106,12 +101,12 @@ function content_taxonomy_tree_process($element, $edit, &$form_state, $form) {
|
|||
}
|
||||
$element['#value'] = content_taxonomy_tree_data2form($element, $element['#value'], $field);
|
||||
}
|
||||
|
||||
|
||||
$element[$field_key] = array(
|
||||
'#type' => 'taxonomy_manager_tree',
|
||||
'#default_value' => isset($element['#value']) ? $element['#value'] : '',
|
||||
'#vid' => $field['vid'],
|
||||
'#parent' => content_taxonomy_field_get_parent($field),
|
||||
'#parent' => content_taxonomy_field_get_parent($field),
|
||||
'#default_value' => is_array($element['#value']) ? $element['#value'] : array(),
|
||||
'#render_whole_tree' => TRUE,
|
||||
'#pager' => FALSE,
|
||||
|
@ -126,12 +121,12 @@ function content_taxonomy_tree_process($element, $edit, &$form_state, $form) {
|
|||
'#title' => $element['#title'],
|
||||
'#description' => $element['#description'],
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
// Make sure field info will be available to the validator which
|
||||
// does not get the values in $form.
|
||||
$form_state['#field_info'][$field['field_name']] = $field;
|
||||
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
|
@ -146,7 +141,7 @@ function content_taxonomy_tree_validate($element, &$form_state) {
|
|||
$field_key = $element['#columns'][0];
|
||||
|
||||
$values = content_taxonomy_tree_form2data($element, $form_state, $field);
|
||||
|
||||
|
||||
//check for required fields
|
||||
//if $element['#value'] is empty, it's validated by form.inc
|
||||
//otherwise we have to check this by our own
|
||||
|
@ -156,9 +151,9 @@ function content_taxonomy_tree_validate($element, &$form_state) {
|
|||
if (($field['multiple'] >= 2) && (count($element['#value']) > $field['multiple'])) {
|
||||
form_error($element[$field_key], t('%name: this field cannot hold more than @count values.', array('%name' => t($field['widget']['label']), '@count' => $field['multiple'])));
|
||||
}
|
||||
|
||||
|
||||
form_set_value($element, $values, $form_state);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +181,7 @@ function content_taxonomy_tree_form2data($element, &$form_state, $field) {
|
|||
if (!is_array($selected_terms) || !count($selected_terms)) {
|
||||
$selected_terms[] = NULL;
|
||||
}
|
||||
|
||||
|
||||
$form_state['#field_info'][$field['field_name']] = $field;
|
||||
return content_transpose_array_rows_cols(array($element['#columns'][0] => array_values($selected_terms)));
|
||||
}
|
||||
|
|
Reference in a new issue