This commit is contained in:
2025-12-11 16:01:25 +01:00
parent 4e7df5d2a3
commit d3f8dbbfb4
5 changed files with 112 additions and 1 deletions

View File

@@ -56,4 +56,27 @@
font-weight: 400;
line-height: 1;
margin: 0;
}
.elementor-widget-acf-product-label .product-label {
position: absolute;
left: 10px;
top: 10px;
z-index: 10;
}
.elementor-widget-acf-product-label .product-label span {
display: inline-block;
padding: 5px 20px 5px;
background: black;
color: #fff;
border-radius: 50px;
font-size: 16px;
}
.elementor-widget-acf-product-label .product-label span.aluplast {
color: #fff;
background: #d10a11;
}
.elementor-widget-acf-product-label .product-label span.rehau {
color: #fff;
background: #37a58c;
}/*# sourceMappingURL=main.css.map */

View File

@@ -1 +1 @@
{"version":3,"sources":["main.scss","main.css"],"names":[],"mappings":"AACC;EACC,UAAA;EACA,SAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,QAAA;ACAF;ADGG;EACC,WAAA;EACA,eAAA;EACA,YAAA;EACA,gBAAA;ACDJ;;ADQC;EACC,aAAA;EACA,SAAA;EACA,gBAAA;EACA,gDAAA;ACLF;ADOE;EACC,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,qBAAA;OAAA,gBAAA;ACLH;ADOG;EACC,mBAAA;ACLJ;ADQG;EACC,aAAA;EACA,mBAAA;ACNJ;ADQI;EACC,WAAA;EACA,eAAA;EACA,sBAAA;KAAA,mBAAA;ACNL;ADUI;EACC,eAAA;EACA,oCAAA;EACA,gBAAA;EACA,cAAA;EACA,iBAAA;ACRL;ADUK;EACC,mCAAA;ACRN;ADWI;EACC,eAAA;EACA,oCAAA;EACA,gBAAA;EACA,cAAA;EACA,SAAA;ACTL","file":"main.css"}
{"version":3,"sources":["main.scss","main.css"],"names":[],"mappings":"AACC;EACC,UAAA;EACA,SAAA;EACA,gBAAA;EACA,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,QAAA;ACAF;ADGG;EACC,WAAA;EACA,eAAA;EACA,YAAA;EACA,gBAAA;ACDJ;;ADQC;EACC,aAAA;EACA,SAAA;EACA,gBAAA;EACA,gDAAA;ACLF;ADOE;EACC,aAAA;EACA,mBAAA;EACA,mBAAA;EACA,qBAAA;OAAA,gBAAA;ACLH;ADOG;EACC,mBAAA;ACLJ;ADQG;EACC,aAAA;EACA,mBAAA;ACNJ;ADQI;EACC,WAAA;EACA,eAAA;EACA,sBAAA;KAAA,mBAAA;ACNL;ADUI;EACC,eAAA;EACA,oCAAA;EACA,gBAAA;EACA,cAAA;EACA,iBAAA;ACRL;ADUK;EACC,mCAAA;ACRN;ADWI;EACC,eAAA;EACA,oCAAA;EACA,gBAAA;EACA,cAAA;EACA,SAAA;ACTL;;ADiBC;EACC,kBAAA;EACA,UAAA;EACA,SAAA;EACA,WAAA;ACdF;ADgBE;EACC,qBAAA;EACA,qBAAA;EACA,iBAAA;EACA,WAAA;EACA,mBAAA;EACA,eAAA;ACdH;ADgBG;EACC,WAAA;EACA,mBAAA;ACdJ;ADgBG;EACC,WAAA;EACA,mBAAA;ACdJ","file":"main.css"}

View File

@@ -69,3 +69,30 @@
}
}
}
.elementor-widget-acf-product-label {
.product-label {
position: absolute;
left: 10px;
top: 10px;
z-index: 10;
span {
display: inline-block;
padding: 5px 20px 5px;
background: black;
color: #fff;
border-radius: 50px;
font-size: 16px;
&.aluplast {
color: #fff;
background: #d10a11;
}
&.rehau {
color: #fff;
background: #37a58c;
}
}
}
}

View File

@@ -17,11 +17,13 @@ function register_hello_world_widget( $widgets_manager ) {
require_once( __DIR__ . '/widgets/acf-product-parameters.php' );
require_once( __DIR__ . '/widgets/places-map.php' );
require_once( __DIR__ . '/widgets/product-featured-image.php' );
require_once( __DIR__ . '/widgets/acf-product-label.php' );
$widgets_manager->register( new \Elementor_Images_List() );
$widgets_manager->register( new \Elementor_ACF_Product_Parameters() );
$widgets_manager->register( new \Elementor_Places_Map() );
$widgets_manager->register( new \Elementor_Product_Featured_Image() );
$widgets_manager->register( new \Elementor_ACF_Product_Label() );
}
add_action( 'elementor/widgets/register', 'register_hello_world_widget' );

View File

@@ -0,0 +1,59 @@
<?php
if (!defined('ABSPATH')) {
exit;
}
use Elementor\Controls_Manager;
use Elementor\Icons_Manager;
use Elementor\Repeater;
use Elementor\Utils;
class Elementor_ACF_Product_Label extends \Elementor\Widget_Base {
public function get_name() {
return 'acf-product-label';
}
public function get_title() {
return esc_html__('ACF Product Label', 'elementor-addon');
}
public function get_icon() {
return 'eicon-code';
}
public function get_categories() {
return ['basic'];
}
public function get_keywords() {
return ['global', 'label'];
}
protected function register_controls() {
$this->start_controls_section(
'list_section',
[
'label' => esc_html__('Setting', 'elementor-addon'),
]
);
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
$acf_product_label = get_field('label');
if (empty($acf_product_label) || $acf_product_label == 'BRAK') {
return;
}
?>
<div class="product-label">
<span class="<?php echo strtolower(iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $acf_product_label)); ?>">
<?php echo $acf_product_label; ?>
</span>
</div>
<?php
}
}