sioweb/oxid-metadata-multi-select

Mit diesem Modul können Select-Optionen in der Metadata als 'Multiple' gekennzeichnet werden.

Installs: 1 258

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:oxidkernel-module

1.1.1 2020-07-13 09:32 UTC

This package is auto-updated.

Last update: 2024-04-13 17:35:54 UTC


README

Moduloptionen unterstützen unter Anderem Select-Boxen, welche allerdings nur einen Wert auswählbar zulassen. Mit diesem Modul, können die Select um die Attribute multiple, size und style erweitert werden.

Optionen

  • (bool) multiple Markiert das Select als multiple=>"true"
  • (int) size Wird per default auf 8 gestellt.
  • (string) style wird als Inline-CSS-Attribute eingefügt

Beispiel

$aModule = [
    'settings' => [
        ['group' => 'some_group_name', 'name' => 'aFieldName', 'type' => 'select', 'multiple' => true, 'style' => 'width:400px;', 'constraints' => '1|2|3', 'value' => '']
    ]
];

Beispiel - Alle Controller auswählen

Ein Modul könnte z.B. nur auf bestimmte Controller beschränkt werden. Diese können wie folgt ausgelesen und als Parameter hinzugefügt werden:

metadata.php

/**
 * Metadata version
 */
$sMetadataVersion = '2.0';

$sQ = "SELECT oxstdurl, oxobjectid, oxseourl FROM oxseo WHERE oxtype='static' && oxlang = ? && oxshopid = ? GROUP BY oxobjectid ORDER BY oxstdurl";

$oStaticUrlList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oStaticUrlList->init('oxbase', 'oxseo');
$oStaticUrlList->selectString($sQ, [0, 1]);

$aModule = [
    // ...
    'settings' => [
        ['group' => 'some_group_name', 'name' => 'aFieldName', 'type' => 'select', 'multiple' => true, 'value' => '', 'style' => 'width:400px;', 'constraints' => implode('|', array_keys($oStaticUrlList->aList))]
    ]
];

admin/de/module_options.php

$sLangName = "Deutsch";

$aLang = array(
    'charset' => 'UTF-8',
    'SHOP_MODULE_aFieldName' => 'Multi-Select-Feld',
);


$sQ = "SELECT oxstdurl, oxobjectid, oxseourl FROM oxseo WHERE oxtype='static' && oxlang = ? && oxshopid = ? GROUP BY oxobjectid ORDER BY oxstdurl";

$oStaticUrlList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
$oStaticUrlList->init('oxbase', 'oxseo');
$oStaticUrlList->selectString($sQ, [0, 1]);
foreach($oStaticUrlList as $key => $oItem) {
    $aLang['SHOP_MODULE_aFieldName_' . $key] = $oItem->oxseo__oxstdurl->getRawValue() . '      ' . $oItem->oxseo__oxseourl->getRawValue();
}