本文整理汇总了PHP中Stylesheet::add_rules方法的典型用法代码示例。如果您正苦于以下问题:PHP Stylesheet::add_rules方法的具体用法?PHP Stylesheet::add_rules怎么用?PHP Stylesheet::add_rules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stylesheet
的用法示例。
在下文中一共展示了Stylesheet::add_rules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _parse_schemes_css_code
protected function _parse_schemes_css_code()
{
foreach (Plugin::instance()->widgets_manager->get_widget_types() as $widget) {
foreach ($widget->get_scheme_controls() as $control) {
$scheme_value = Plugin::instance()->schemes_manager->get_scheme_value($control['scheme']['type'], $control['scheme']['value']);
if (empty($scheme_value)) {
continue;
}
if (!empty($control['scheme']['key'])) {
$scheme_value = $scheme_value[$control['scheme']['key']];
}
if (empty($scheme_value)) {
continue;
}
$element_unique_class = 'elementor-widget-' . $widget->get_name();
$control_obj = Plugin::instance()->controls_manager->get_control($control['type']);
if (Controls_Manager::FONT === $control_obj->get_type()) {
$this->add_enqueue_font($scheme_value);
}
foreach ($control['selectors'] as $selector => $css_property) {
$output_selector = str_replace('{{WRAPPER}}', '.' . $element_unique_class, $selector);
$output_css_property = $control_obj->get_replaced_style_values($css_property, $scheme_value);
$this->stylesheet->add_rules($output_selector, $output_css_property);
}
}
}
}
示例2: add_control_style_rules
private function add_control_style_rules($control, $value, $placeholders, $replacements)
{
if (!is_numeric($value) && !is_float($value) && empty($value)) {
return;
}
if (Controls_Manager::FONT === $control['type']) {
$this->fonts[] = $value;
}
$control_obj = Plugin::instance()->controls_manager->get_control($control['type']);
foreach ($control['selectors'] as $selector => $css_property) {
$parsed_css_property = $control_obj->get_replaced_style_values($css_property, $value);
if (!$parsed_css_property) {
continue;
}
$parsed_selector = str_replace($placeholders, $replacements, $selector);
$device = !empty($control['responsive']) ? $control['responsive'] : Element_Base::RESPONSIVE_DESKTOP;
$this->stylesheet_obj->add_rules($parsed_selector, $parsed_css_property, $device);
}
}