Automattic\WooCommerce\Vendor\Sabberworm\CSS\RuleSet
DeclarationBlock::createShorthandProperties
Устарела с версии since 8.7.0, will be removed without substitution in version 9.0 in #511. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.
Метод класса: DeclarationBlock{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$DeclarationBlock = new DeclarationBlock(); $DeclarationBlock->createShorthandProperties( $aProperties, $sShorthand );
- $aProperties(array<array-key, string>) (обязательный)
- .
- $sShorthand(строка) (обязательный)
- .
Список изменений
| Устарела | С версии 8.7.0 | , will be removed without substitution in version 9.0 in #511 |
Код DeclarationBlock::createShorthandProperties() DeclarationBlock::createShorthandProperties WC 11.2.1
public function createShorthandProperties(array $aProperties, $sShorthand)
{
$aRules = $this->getRulesAssoc();
$oRule = null;
$aNewValues = [];
foreach ($aProperties as $sProperty) {
if (!isset($aRules[$sProperty])) {
continue;
}
$oRule = $aRules[$sProperty];
if (!$oRule->getIsImportant()) {
$mRuleValue = $oRule->getValue();
$aValues = [];
if (!$mRuleValue instanceof RuleValueList) {
$aValues[] = $mRuleValue;
} else {
$aValues = $mRuleValue->getListComponents();
}
foreach ($aValues as $mValue) {
$aNewValues[] = $mValue;
}
$this->removeRule($sProperty);
}
}
if ($aNewValues !== [] && $oRule instanceof Rule) {
$oNewRule = new Rule($sShorthand, $oRule->getLineNo(), $oRule->getColNo());
foreach ($aNewValues as $mValue) {
$oNewRule->addValue($mValue);
}
$this->addRule($oNewRule);
}
}