File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/checkbox.tar
checkbox.php 0000644 00000002567 15155521552 0007063 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
/**
*
* Field: Checkbox
*
* @since 1.0.0
* @version 1.0.0
*
*/
class CSFramework_Option_checkbox extends CSFramework_Options {
public function __construct( $field, $value = '', $unique = '' ) {
parent::__construct( $field, $value, $unique );
}
public function output() {
echo $this->element_before();
if( isset( $this->field['options'] ) ) {
$options = $this->field['options'];
$options = ( is_array( $options ) ) ? $options : array_filter( $this->element_data( $options ) );
if( ! empty( $options ) ) {
echo '<ul'. $this->element_class() .'>';
foreach ( $options as $key => $value ) {
echo '<li><label><input type="checkbox" name="'. $this->element_name( '[]' ) .'" value="'. $key .'"'. $this->element_attributes( $key ) . $this->checked( $this->element_value(), $key ) .'/> '.$value.'</label></li>';
}
echo '</ul>';
}
} else {
$label = ( isset( $this->field['label'] ) ) ? $this->field['label'] : '';
echo '<label><input type="checkbox" name="'. $this->element_name() .'" value="1"'. $this->element_class() . $this->element_attributes() . checked( $this->element_value(), 1, false ) .'/> '. $label .'</label>';
}
echo $this->element_after();
}
}
block.json 0000644 00000001576 15155677057 0006564 0 ustar 00 {
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "woocommerce/product-checkbox-field",
"title": "Product checkbox control",
"category": "woocommerce",
"description": "The product checkbox.",
"keywords": ["products", "checkbox", "input"],
"textdomain": "default",
"attributes": {
"title": {
"type": "string",
"__experimentalRole": "content"
},
"label": {
"type": "string"
},
"property": {
"type": "string"
},
"tooltip": {
"type": "string"
}
},
"supports": {
"align": false,
"html": false,
"multiple": true,
"reusable": false,
"inserter": false,
"lock": false,
"__experimentalToolbar": false
},
"editorStyle": "file:./editor.css"
}
edit.js 0000644 00000002260 15155677057 0006051 0 ustar 00 "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Edit=void 0;const element_1=require("@wordpress/element"),components_1=require("@wordpress/components"),block_editor_1=require("@wordpress/block-editor"),core_data_1=require("@wordpress/core-data"),icons_1=require("@wordpress/icons");function Edit({attributes:e}){const o=(0,block_editor_1.useBlockProps)({className:"woocommerce-product-form__checkbox"}),{property:t,title:r,label:c,tooltip:n}=e,[l,s]=(0,core_data_1.useEntityProp)("postType","product",t);return(0,element_1.createElement)("div",{...o},(0,element_1.createElement)("h4",null,r),(0,element_1.createElement)("div",{className:"woocommerce-product-form__checkbox-wrapper"},(0,element_1.createElement)(components_1.CheckboxControl,{label:c,checked:l,onChange:e=>s(e)}),n&&(0,element_1.createElement)(components_1.Tooltip,{text:(0,element_1.createElement)("span",null,n),position:"top center",className:"woocommerce-product-form__checkbox-tooltip",delay:0},(0,element_1.createElement)("span",{className:"woocommerce-product-form__checkbox-tooltip-icon"},(0,element_1.createElement)(icons_1.Icon,{icon:icons_1.help,size:21.94,fill:"#949494"})))))}exports.Edit=Edit; index.js 0000644 00000001127 15155677057 0006234 0 ustar 00 "use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.init=exports.settings=exports.name=exports.metadata=void 0;const init_block_1=require("../../utils/init-block"),block_json_1=__importDefault(require("./block.json")),edit_1=require("./edit"),{name,...metadata}=block_json_1.default;exports.name=name,exports.metadata=metadata,exports.settings={example:{},edit:edit_1.Edit};const init=()=>(0,init_block_1.initBlock)({name,metadata,settings:exports.settings});exports.init=init;