Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndr-w authored and github-actions[bot] committed May 12, 2024
1 parent 87169ac commit e38f8c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
39 changes: 18 additions & 21 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,37 @@
$addon = rex_addon::get('wildcard');

if (rex_addon::get('yform')->isAvailable() && !rex::isSafeMode()) {

// Laden Sie die JSON-Datei
// Laden Sie die JSON-Datei
$tableset = rex_file::get(rex_path::addon($addon->getName(), 'install/rex_wildcard.tableset.json'));

// Konvertieren Sie die JSON-Datei in ein PHP-Array
$data = json_decode($tableset, true);

// Durchsuchen Sie das Array nach dem Feld mit dem Namen "wildcard" und der Priorität 2
foreach ($data['rex_wildcard']['fields'] as $index => $field) {
if ($field['name'] === 'wildcard' && $field['prio'] === 2) {
if ('wildcard' === $field['name'] && 2 === $field['prio']) {
foreach (rex_clang::getAll() as $clang) {

// Erstellen Sie das neue Feld
$newField = [
"table_name" => "rex_wildcard",
"prio" => 3,
"type_id" => "value",
"type_name" => "textarea",
"db_type" => "text",
"list_hidden" => 0,
"search" => 1,
"name" => "text_".$clang->getCode(),
"label" => "translate:wildcard_text_".$clang->getCode(),
"not_required" => "",
"attributes" => "",
"default" => "",
"no_db" => "0",
"notice" => "",
'table_name' => 'rex_wildcard',
'prio' => 3,
'type_id' => 'value',
'type_name' => 'textarea',
'db_type' => 'text',
'list_hidden' => 0,
'search' => 1,
'name' => 'text_' . $clang->getCode(),
'label' => 'translate:wildcard_text_' . $clang->getCode(),
'not_required' => '',
'attributes' => '',
'default' => '',
'no_db' => '0',
'notice' => '',
];

// Fügen Sie das neue Feld direkt nach dem gefundenen Feld ein
array_splice($data['rex_wildcard']['fields'], $index + 1, 0, [$newField]);
}
}
// Sobald das neue Feld hinzugefügt wurde, beenden Sie die Schleife
break;
}
Expand All @@ -49,7 +47,6 @@
rex_yform_manager_table::deleteCache();
}


/* Zusätzliche Eigenschaften an der Tabelle direkt setzen, z.B. Index-Felder zur Performance-Optimierung */

$table = rex_sql_table::get(rex::getTable('wildcard'));
Expand All @@ -58,7 +55,7 @@
$table = $table->ensureColumn(new rex_sql_column('wildcard', 'varchar(191)', false, ''));
foreach (rex_clang::getAll() as $clang) {
$table = $table->ensureColumn(new rex_sql_column('text_' . $clang->getId(), 'text', true));
$table = $table->ensureColumn(new rex_sql_column('text_' . \rex_string::normalize($clang->getCode()), 'text', true));
$table = $table->ensureColumn(new rex_sql_column('text_' . rex_string::normalize($clang->getCode()), 'text', true));
}
$table = $table->ensureColumn(new rex_sql_column('createdate', 'datetime'));
$table = $table->ensureColumn(new rex_sql_column('createuser', 'varchar(191)', false, ''));
Expand Down
1 change: 0 additions & 1 deletion lib/wildcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public static function getCurrentFieldName($field = 'text', $separator = '_')

public static function findWildcard(string $wildcard, mixed $clang_code = null)
{

$clang_code ??= rex_clang::getCurrent()->getCode();
$wildcard = self::query()
->where('wildcard', $wildcard)
Expand Down

0 comments on commit e38f8c2

Please sign in to comment.