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