updated synonyms to 1.5

This commit is contained in:
Bachir Soussi Chiadmi
2016-11-05 17:54:56 +01:00
parent 773e7fbddd
commit 252abe9b0e
51 changed files with 6500 additions and 2484 deletions

View File

@@ -5,16 +5,18 @@
* Plugin to provide a synonyms-friendly argument handler for a Taxonomy term.
*/
$plugin = array(
'title' => t("Taxonomy term: ID (synonyms-friendly)"),
'keyword' => 'term',
'description' => t('Creates a single taxonomy term from a taxonomy term name or one of its synonyms.'),
'context' => 'synonyms_term_synonyms_context',
'default' => array('breadcrumb' => TRUE, 'transform' => FALSE),
'settings form' => 'synonyms_term_synonyms_settings_form',
'placeholder form' => 'synonyms_term_synonyms_ctools_argument_placeholder',
'breadcrumb' => 'synonyms_term_synonyms_breadcrumb',
);
if (module_exists('taxonomy')) {
$plugin = array(
'title' => t("Taxonomy term: ID (synonyms-friendly)"),
'keyword' => 'term',
'description' => t('Creates a single taxonomy term from a taxonomy term name or one of its synonyms.'),
'context' => 'synonyms_term_synonyms_context',
'default' => array('breadcrumb' => TRUE, 'transform' => FALSE),
'settings form' => 'synonyms_term_synonyms_settings_form',
'placeholder form' => 'synonyms_term_synonyms_ctools_argument_placeholder',
'breadcrumb' => 'synonyms_term_synonyms_breadcrumb',
);
}
/**
* Discover if this argument gives us the term we crave.
@@ -66,12 +68,12 @@ function synonyms_term_synonyms_context($arg = NULL, $conf = NULL, $empty = FALS
foreach ($vocabularies as $vocabulary) {
$condition = db_and();
if ($conf['transform']) {
$condition->where("REPLACE(" . AbstractSynonymsSynonymsBehavior::COLUMN_PLACEHOLDER . ", ' ', '-') = :argument", array(
$condition->where("REPLACE(" . AbstractSynonymsBehavior::COLUMN_SYNONYM_PLACEHOLDER . ", ' ', '-') = :argument", array(
':argument' => $arg,
));
}
else {
$condition->condition(AbstractSynonymsSynonymsBehavior::COLUMN_PLACEHOLDER, $arg);
$condition->condition(AbstractSynonymsBehavior::COLUMN_SYNONYM_PLACEHOLDER, $arg);
}
$rows = synonyms_synonyms_find($condition, 'taxonomy_term', $vocabulary->machine_name);
if (!empty($rows)) {

View File

@@ -23,8 +23,8 @@ function synonyms_behavior_autocomplete_settings_form($form, &$form_state, $sett
$element['wording'] = array(
'#type' => 'textfield',
'#title' => t('Autocomplete wording'),
'#default_value' => isset($settings['wording']) ? $settings['wording'] : '@synonym is a synonym of @term',
'#description' => t('Specify with what wording the synonyms should be suggested in the autocomplete feature. You may use: <ul><li><em>@synonym</em> to denote value of the synonym</li><li><em>@term</em> to denote term name</li><li><em>@field_name</em> to denote lowercase label of the field from where the synonym originates</li></ul>'),
'#default_value' => isset($settings['wording']) ? $settings['wording'] : '@synonym is a synonym of @entity',
'#description' => t('Specify with what wording the synonyms should be suggested in the autocomplete feature. You may use: <ul><li><em>@synonym</em> to denote value of the synonym</li><li><em>@entity</em> to denote entity name</li><li><em>@field_name</em> to denote lowercase label of the field from where the synonym originates</li></ul>'),
'#required' => TRUE,
);

View File

@@ -24,7 +24,7 @@ function synonyms_behavior_select_settings_form($form, &$form_state, $settings)
'#type' => 'textfield',
'#title' => t('Select wording'),
'#default_value' => isset($settings['wording']) ? $settings['wording'] : '@synonym',
'#description' => t('Specify with what wording the synonyms should be placed in the select form element. You may use: <ul><li><em>@synonym</em> to denote value of the synonym</li><li><em>@term</em> to denote term name</li><li><em>@field_name</em> to denote lowercase label of the field from where the synonym originates</li></ul>'),
'#description' => t('Specify with what wording the synonyms should be placed in the select form element. You may use: <ul><li><em>@synonym</em> to denote value of the synonym</li><li><em>@entity</em> to denote entity name</li><li><em>@field_name</em> to denote lowercase label of the field from where the synonym originates</li></ul>'),
'#required' => TRUE,
);

View File

@@ -1,12 +0,0 @@
<?php
/**
* @file
* Plugin definition for most general synonyms behavior.
*/
$plugin = array(
'title' => t('Include into term synonyms'),
'description' => t('Basic behavior that includes values of this field into the list of synonyms of its entity.'),
'interface' => 'SynonymsSynonymsBehavior',
);