Skip to content

Commit

Permalink
manager: Add Custom Icon for Tables (#1518)
Browse files Browse the repository at this point in the history
* add customIcon

* add CustomIcon

* add customIcon

* add customIcon

* Update boot.php

* add table_icon to api.php

* csfix table_edit.php

* csfix table.php

* add class yform-table-icon

so kann das Feld evtl. mit einer externen Pickerlösung ausgestattet werden.

* add table_icon to table

... Mist vergessen

* auf text(191) gesetzt

* varchar

* Nullable Type für getCustomIcon
  • Loading branch information
skerbis authored Sep 7, 2024
1 parent 891c465 commit b5d36a0
Showing 6 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/manager/boot.php
Original file line number Diff line number Diff line change
@@ -49,7 +49,8 @@
if ($table->isActive() && $table->isGranted('VIEW', rex::getUser())) {
$be_page = new rex_be_page_main('yform_tables', $table->getTableName(), rex_escape($table->getNameLocalized()));
$be_page->setHref('index.php?page=yform/manager/data_edit&table_name=' . $table->getTableName());
$be_page->setIcon('rex-icon rex-icon-module');
$icon = rex_escape($table->getCustomIcon() ?: 'rex-icon-module');
$be_page->setIcon('rex-icon ' . $icon);
$be_page->setPrio($prio);

if ($table->isHidden()) {
1 change: 1 addition & 0 deletions plugins/manager/install.php
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
->ensureColumn(new rex_sql_column('table_name', 'varchar(191)'))
->ensureColumn(new rex_sql_column('name', 'varchar(191)'))
->ensureColumn(new rex_sql_column('description', 'text'))
->ensureColumn(new rex_sql_column('table_icon', 'varchar(191)'))
->ensureColumn(new rex_sql_column('list_amount', 'int(11)', false, '50'))
->ensureColumn(new rex_sql_column('list_sortfield', 'varchar(191)', false, 'id'))
->ensureColumn(new rex_sql_column('list_sortorder', 'enum(\'ASC\',\'DESC\')', false, 'ASC'))
1 change: 1 addition & 0 deletions plugins/manager/lang/de_de.lang
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ yform_manager_table_name = Name
yform_manager_table_status = Status
yform_manager_name = Bezeichnung
yform_manager_table_description = Beschreibung
yform_manager_custom_icon = Individuelles Icon
yform_manager_entries_per_page = Datensätze pro Seite
yform_manager_sortfield = Standardsortierung: Feld
yform_manager_sortorder = Richtung
5 changes: 5 additions & 0 deletions plugins/manager/lib/yform/manager/table.php
Original file line number Diff line number Diff line change
@@ -241,6 +241,11 @@ public function getDescription(): string
return $this->values['description'];
}

public function getCustomIcon(): ?string
{
return $this->values['table_icon'];
}

/**
* Fields of yform Definitions.
*
2 changes: 1 addition & 1 deletion plugins/manager/lib/yform/manager/table/api.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
class rex_yform_manager_table_api
{
/** @var array<int, string> */
public static array $table_fields = ['status', 'name', 'description', 'list_amount', 'list_sortfield', 'list_sortorder', 'prio', 'search', 'hidden', 'export', 'import', 'schema_overwrite'];
public static array $table_fields = ['status', 'name', 'description', 'table_icon', 'list_amount', 'list_sortfield', 'list_sortorder', 'prio', 'search', 'hidden', 'export', 'import', 'schema_overwrite'];
public static bool $debug = false;
public static array $cacheColumnsByTable = [];

1 change: 1 addition & 0 deletions plugins/manager/pages/table_edit.php
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@
$yform->setValueField('text', ['name', rex_i18n::msg('yform_manager_name')]);
$yform->setValidateField('empty', ['name', rex_i18n::msg('yform_manager_table_enter_name')]);
$yform->setValueField('textarea', ['description', '<br />' . rex_i18n::msg('yform_manager_table_description'), 'attributes' => '{"class":"form-control yform-textarea-short"}']);
$yform->setValueField('text', ['table_icon', rex_i18n::msg('yform_manager_custom_icon'), 'attributes' => '{"class":"form-control yform-table-icon"}']);

$yform->setValueField('html', ['html' => '</div><div class="col-md-6">']);

0 comments on commit b5d36a0

Please sign in to comment.