Skip to content
Snippets Groups Projects

Update Taxonomy.php

1 file
+ 22
3
Compare changes
  • Side-by-side
  • Inline
@@ -126,7 +126,7 @@ class Taxonomy extends RuleBase implements ContainerFactoryPluginInterface {
$form['automator_clean_up'] = [
'#type' => 'select',
'#title' => 'Text Manipulation',
'#title' => $this->t('Text Manipulation'),
'#description' => $this->t('These are possible text manipulations to run on each created tag.'),
'#options' => [
'' => $this->t('None'),
@@ -134,7 +134,25 @@ class Taxonomy extends RuleBase implements ContainerFactoryPluginInterface {
'uppercase' => $this->t('UPPERCASE'),
'first_char' => $this->t('First character uppercase'),
],
'#default_value' => $fieldDefinition->getConfig($entity->bundle())->getThirdPartySetting('ai_automator', 'automator_clean_up', ''),
// Use the default value from the third-party settings or fallback to a default.
'#default_value' => $fieldDefinition->getConfig($entity->bundle())
->getThirdPartySetting('ai_automators', 'automator_clean_up', 'first_char'), // Ensure fallback here
'#weight' => 23,
];
$form['automator_clean_up'] = [
'#type' => 'select',
'#title' => $this->t('Text Manipulation'),
'#description' => $this->t('These are possible text manipulations to run on each created tag.'),
'#options' => [
'' => $this->t('None'),
'lowercase' => $this->t('lowercase'),
'uppercase' => $this->t('UPPERCASE'),
'first_char' => $this->t('First character uppercase'),
],
// Use the default value from the third-party settings or fallback to a default.
'#default_value' => $fieldDefinition->getConfig($entity->bundle())
->getThirdPartySetting('ai_automators', 'automator_clean_up', 'first_char'), // Ensure fallback here
'#weight' => 23,
];
@@ -143,7 +161,8 @@ class Taxonomy extends RuleBase implements ContainerFactoryPluginInterface {
'#type' => 'checkbox',
'#title' => 'Find similar tags',
'#description' => $this->t('This will use GPT-4 to find similar tags. Meaning if the tag "Jesus Christ" exists and the system wants to store "Jesus" it will store it as "Jesus Christ". This uses extra calls and is slower and more costly.'),
'#default_value' => $fieldDefinition->getConfig($entity->bundle())->getThirdPartySetting('ai_automator', 'automator_search_similar_tags', FALSE),
'#default_value' => $fieldDefinition->getConfig($entity->bundle())
->getThirdPartySetting('ai_automators', 'automator_search_similar_tags', 1), // Ensure fallback here
'#weight' => 23,
];
}
Loading