This commit is contained in:
2026-07-02 15:54:39 -06:00
commit 9883323161
17470 changed files with 4470592 additions and 0 deletions
@@ -0,0 +1,54 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Theme_Layers\Framework\Traits;
use Gravity_Forms\Gravity_Forms\Theme_Layers\GF_Theme_Layers_Provider;
trait Enqueues_Assets {
/**
* Provides an array of scripts to be enqueued for the form.
*
* @since 2.7
*
* @param $form The Form being processed.
* @param $ajax Whether this is an AJAX request.
* @param $settings The current settings for this form.
* @param $block_settings The current block settings for this form.
*
* @return array
*/
abstract public function scripts( $form, $ajax, $settings, $block_settings = array() );
/**
* Provides an array of styles to be enqueued for the form.
*
* @since 2.7
*
* @param $form The Form being processed.
* @param $ajax Whether this is an AJAX request.
* @param $settings The current settings for this form.
* @param $block_settings The current block settings for this form.
*
* @return array
*/
abstract public function styles( $form, $ajax, $settings, $block_settings = array() );
/**
* Add the engine.
*
* @since 2.7
*
* @return void
*/
public function add_engine_asset_enqueues() {
$engine = $this->output_engine_factory->get( GF_Theme_Layers_Provider::ASSET_ENQUEUE_OUTPUT_ENGINE );
$engine->set_styles( array( $this, 'styles' ) );
$engine->set_scripts( array( $this, 'scripts' ) );
$this->output_engines[] = $engine;
add_action( 'init', array( $engine, 'output' ), 11 );
}
}
@@ -0,0 +1,38 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Theme_Layers\Framework\Traits;
use Gravity_Forms\Gravity_Forms\Theme_Layers\GF_Theme_Layers_Provider;
trait Has_Block_Settings {
/**
* Returns an array of settings to add to the block.
*
* @since 2.7
*
* @return array
*/
abstract public function block_settings();
/**
* Add the engine.
*
* @since 2.7
*
* @return void
*/
public function add_engine_block_settings() {
$engine = $this->definition_engine_factory->get( GF_Theme_Layers_Provider::BLOCK_SETTINGS_DEFINITION_ENGINE );
$engine->set_block_settings( $this->block_settings() );
$this->definition_engines[] = $engine;
add_filter( 'gform_form_block_attributes', function( $attributes ) use ( $engine ) {
$defined_attrs = $engine->get_definitions();
return array_merge( $attributes, $defined_attrs );
}, 10, 1 );
}
}
@@ -0,0 +1,32 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Theme_Layers\Framework\Traits;
use Gravity_Forms\Gravity_Forms\Theme_Layers\GF_Theme_Layers_Provider;
trait Has_Settings_Fields {
/**
* Return an array of settings fields to add for this theme layer.
*
* @since 2.7
*
* @return array
*/
abstract public function settings_fields();
/**
* Add the engine.
*
* @since 2.7
*
* @return void
*/
public function add_engine_settings_field() {
$engine = $this->definition_engine_factory->get( GF_Theme_Layers_Provider::SETTINGS_DEFINITION_ENGINE );
$engine->set_fields( $this->settings_fields() );
$this->definition_engines[] = $engine;
}
}
@@ -0,0 +1,34 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Theme_Layers\Framework\Traits;
use Gravity_Forms\Gravity_Forms\Theme_Layers\GF_Theme_Layers_Provider;
trait Modifies_Markup {
/**
* Return an array of views to override for fields/forms.
*
* @since 2.7
*
* @return array
*/
abstract public function overriden_fields();
/**
* Add the engine.
*
* @since 2.7
*
* @return void
*/
public function add_engine_markup_output() {
$engine = $this->output_engine_factory->get( GF_Theme_Layers_Provider::MARKUP_OUTPUT_ENGINE );
$engine->set_views( $this->overriden_fields() );
$this->output_engines[] = $engine;
add_action( 'init', array( $engine, 'output' ), 11 );
}
}
@@ -0,0 +1,41 @@
<?php
namespace Gravity_Forms\Gravity_Forms\Theme_Layers\Framework\Traits;
use Gravity_Forms\Gravity_Forms\Theme_Layers\GF_Theme_Layers_Provider;
/**
* Provides methods for outputting custom CSS Properties for a form.
*
* @since 2.7
*/
trait Outputs_Form_CSS_Properties {
/**
* Return an array of key/value pairs for CSS output.
*
* @since 2.7
*
* @param $form_id The ID of the form being processed.
*
* @return array
*/
abstract public function form_css_properties( $form_id );
/**
* Add the engine.
*
* @since 2.7
*
* @return void
*/
public function add_engine_form_css_properties() {
$engine = $this->output_engine_factory->get( GF_Theme_Layers_Provider::FORM_CSS_PROPERTIES_OUTPUT_ENGINE );
$engine->set_form_css_properties_cb( array( $this, 'form_css_properties' ) );
$this->output_engines[] = $engine;
add_action( 'init', array( $engine, 'output' ), 11 );
}
}