| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Core\Kits\Controls; |
| 4 |
|
| 5 |
use Elementor\Control_Repeater; |
| 6 |
|
| 7 |
if ( ! defined( 'ABSPATH' ) ) { |
| 8 |
exit; // Exit if accessed directly |
| 9 |
} |
| 10 |
|
| 11 |
class Repeater extends Control_Repeater { |
| 12 |
|
| 13 |
const CONTROL_TYPE = 'global-style-repeater'; |
| 14 |
|
| 15 |
/** |
| 16 |
* Get control type. |
| 17 |
* |
| 18 |
* Retrieve the control type, in this case `global-style-repeater`. |
| 19 |
* |
| 20 |
* @since 3.0.0 |
| 21 |
* @access public |
| 22 |
* |
| 23 |
* @return string Control type. |
| 24 |
*/ |
| 25 |
public function get_type() { |
| 26 |
return self::CONTROL_TYPE; |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Get repeater control default settings. |
| 31 |
* |
| 32 |
* Retrieve the default settings of the repeater control. Used to return the |
| 33 |
* default settings while initializing the repeater control. |
| 34 |
* |
| 35 |
* @since 3.0.0 |
| 36 |
* @access protected |
| 37 |
* |
| 38 |
* @return array Control default settings. |
| 39 |
*/ |
| 40 |
protected function get_default_settings() { |
| 41 |
$settings = parent::get_default_settings(); |
| 42 |
|
| 43 |
$settings['item_actions']['duplicate'] = false; |
| 44 |
$settings['item_actions']['sort'] = false; |
| 45 |
|
| 46 |
return $settings; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Render repeater control output in the editor. |
| 51 |
* |
| 52 |
* Used to generate the control HTML in the editor using Underscore JS |
| 53 |
* template. The variables for the class are available using `data` JS |
| 54 |
* object. |
| 55 |
* |
| 56 |
* @since 3.0.0 |
| 57 |
* @access public |
| 58 |
*/ |
| 59 |
public function content_template() { |
| 60 |
?> |
| 61 |
<div class="elementor-repeater-fields-wrapper"></div> |
| 62 |
<# if ( itemActions.add ) { #> |
| 63 |
<div class="elementor-button-wrapper"> |
| 64 |
<button class="elementor-button elementor-button-default elementor-repeater-add" type="button"> |
| 65 |
<i class="eicon-plus" aria-hidden="true"></i><span class="elementor-repeater__add-button__text">{{{ addButtonText }}}</span> |
| 66 |
</button> |
| 67 |
</div> |
| 68 |
<# } #> |
| 69 |
<?php |
| 70 |
} |
| 71 |
} |
| 72 |
|