require_asset($asset); } } $selectors = array( 'default' => "$selector button, $selector input[type='button'], $selector input[type='submit'], $selector input[type='reset'], " . "$selector .tpl-button, $selector .tpl-button-primary, $selector .tpl-button-secondary, $selector button.tpl-block-button", // «старый» шаблон заявок ↑ 'main' => "$selector button[type='submit']:not(.tpl-button-secondary), $selector input[type='submit']:not(.tpl-button-secondary), " . "$selector .tpl-button-primary, $selector button.tpl-block-button", // при добавлении селекторов к 'main' их также нужно добавить к 'default', поскольку // стили кнопок отправки формы применяются в дополнение к стилям обычных кнопок ); foreach ($selectors as $type => $button_selector) { $selectors[$type . '_hover'] = str_replace(',', ':hover,', $button_selector) . ':hover'; } foreach ($selectors as $type => $button_selector) { $type_css = ''; foreach ($settings[$type] as $property => $value) { if (strlen($value) && !preg_match('/_unit$/', $property)) { $css_property = strtr($property, '_', '-'); $unit = isset($settings[$type][$property . '_unit']) ? $settings[$type][$property . '_unit'] : ''; $type_css .= "$css_property:$value$unit;"; } } $css .= "$button_selector { $type_css }\n"; } return $css;