# shopbuilder/1.0.0/app/Elementor/Widgets/Controls/ContentFields.php

ShopBuilder – WooCommerce Builder For Elementor, version 1.0.0. 137 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/1.0.0/code/app/Elementor/Widgets/Controls/ContentFields.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/1.0.0/raw/app/Elementor/Widgets/Controls/ContentFields.php
- Modified: 2023-03-09T09:36:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/1.0.0/code/app/Elementor/Widgets/Controls/ContentFields.php#L10-L20`.

```php
<?php
/**
 * Elementor Content Fields Class.
 *
 * This class contains all the common fields for Content tab.
 *
 * @package RadiusTheme\SB
 */

namespace RadiusTheme\SB\Elementor\Widgets\Controls;

use RadiusTheme\SB\Helpers\Fns;
use RadiusTheme\SB\Elementor\Helper\ControlHelper;
use RadiusTheme\SB\Models\GeneralList;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

/**
 * Elementor Content Fields Class.
 */
class ContentFields {
	/**
	 * Tab name.
	 *
	 * @access private
	 * @static
	 *
	 * @var array
	 */
	private static $tab = 'content';

	/**
	 * Social Share Layout section
	 *
	 * @param object $obj Reference object.
	 * @return static
	 */
	public static function share_presets( $obj ) {
		$fields['layout_section'] = $obj->start_section(
			esc_html__( 'Presets', 'shopbuilder' ),
			self::$tab
		);

		$fields['layout'] = [
			'type'      => 'rtsb-image-selector',
			'options'   => ControlHelper::share_layouts(),
			'default'   => 'share-layout1',
			'separator' => 'default',
		];

		$fields['layout_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/share_preset_control', $fields, $obj );
	}

	/**
	 * Social Share Platforms section
	 *
	 * @param object $obj Reference object.
	 *
	 * @return mixed|null
	 */
	public static function share_platforms( $obj ) {
		$sharing_list    = [];
		$defaults        = [];
		$share_platforms = ControlHelper::sharing_settings();

		foreach ( $share_platforms as $share_platform ) {
			switch ( $share_platform ) {
				case 'facebook':
					$share_text = esc_html__( 'Share', 'shopbuilder' );
					break;

				case 'twitter':
					$share_text = esc_html__( 'Tweet', 'shopbuilder' );
					break;

				case 'pinterest':
					$share_text = esc_html__( 'Pin It', 'shopbuilder' );
					break;

				default:
					$share_text = ucfirst( esc_html( $share_platform ) );
			}

			$defaults[]                      = [
				'share_items' => esc_html( $share_platform ),
				'share_text'  => $share_text,
			];
			$sharing_list[ $share_platform ] = ucfirst( esc_html( $share_platform ) );
		}

		$fields['platforms_section'] = $obj->start_section(
			esc_html__( 'Social Share Platforms', 'shopbuilder' ),
			self::$tab
		);

		$fields['show_share_icon'] = [
			'type'        => 'switch',
			'label'       => esc_html__( 'Show Sharing Icon?', 'shopbuilder' ),
			'description' => esc_html__( 'Switch on to show social sharing icon.', 'shopbuilder' ),
			'label_on'    => esc_html__( 'On', 'shopbuilder' ),
			'label_off'   => esc_html__( 'Off', 'shopbuilder' ),
			'separator'   => 'default',
			'default'     => 'yes',
		];

		$fields['share_platforms'] = [
			'type'        => 'repeater',
			'mode'        => 'repeater',
			'label'       => esc_html__( 'Add Sharing Platforms', 'shopbuilder' ),
			'separator'   => 'before',
			'title_field' => '{{{ share_items }}}',
			'fields'      => [
				'share_items' => [
					'label'     => esc_html__( 'Platform Name', 'shopbuilder' ),
					'type'      => 'select',
					'separator' => 'default',
					'options'   => $sharing_list,
				],
				'share_text'  => [
					'label' => esc_html__( 'Sharing Text', 'shopbuilder' ),
					'type'  => 'text',
				],
			],
			'default'     => $defaults,
		];

		$fields['platforms_section_end'] = $obj->end_section();

		return apply_filters( 'rtsb/elements/elementor/platforms_control', $fields, $obj );
	}
}

```
