Skip to main content

GravityKit\GravityMigrate\Settings

Plugin settings class.

Source: src/Settings.php:21

Details​

  • Kind: class
  • Namespace: GravityKit\GravityMigrate

Methods​

MethodDescription
__construct()Constructor.
get_instance()Returns class instance.
get_choices()Returns available choices for exporting data.
get_import_data()Returns data from the import JSON file.
should_probe_source_site()Whether this request should probe the source site for remote accessibility.
staged_import_context()The staged-bundle context the wizard renders from.
import_fields()Settings sections for the import review screen.
plugin_settings()Updates the Foundations settings with GravityMigrate settings data.
add_styles()Adds styles that hide GravityKit Settings sidebar and other elements.
wizard_page_styles()CSS that reshapes Foundation's settings shell for the wizard.

Method Reference​

__construct()​

public function __construct()

Constructor.

Since: 1.0.0

Source: src/Settings.php:114

get_instance()​

public static function get_instance(): Settings

Returns class instance.

Returns​

  • Settings

Since: 1.0.0

Source: src/Settings.php:134

get_choices()​

public function get_choices( $for_import_settings=false )

Returns available choices for exporting data.

Parameters​

NameTypeDefaultDescription
$for_import_settingsboolfalseWhether the choices are for the import review screen, which offers every type regardless of this site's counts.

Returns​

  • array

Since: 1.0.0

Source: src/Settings.php:325

get_import_data()​

public function get_import_data()

Returns data from the import JSON file.

Returns​

  • array — JSON data.

Since: 1.0.0

Source: src/Settings.php:492

should_probe_source_site()​

public static function should_probe_source_site( bool $doing_ajax, bool $is_rest ): bool

Whether this request should probe the source site for remote accessibility.

Only a page render should. The probe makes up to two remote requests at a 30s timeout each, and its single consumer is $src_url_accessible, read by the legacy import_fields() notice at render time -- a request that renders no page pays a minute for nothing.

REST is excluded alongside ajax because the upload route builds a staged context, so the first Settings::get_instance() in a REST request would otherwise fire the probe inside the upload response, where the operator waits it out.

Parameters​

NameTypeDefaultDescription
$doing_ajaxboolWhether this is an admin-ajax request.
$is_restboolWhether this is a REST request.

Returns​

  • bool

Since: %ver%

Source: src/Settings.php:671

staged_import_context()​

public function staged_import_context(): ?array

The staged-bundle context the wizard renders from.

The upload REST route returns this same structure, so the client can pick up a freshly staged bundle without a page reload.

Returns​

  • array | null — Null when a crashed-import record owns this state, which routes to the legacy review screen instead; the caller reloads to reach it.

Since: %ver%

Source: src/Settings.php:686

import_fields()​

public function import_fields()

Settings sections for the import review screen.

Returns​

  • array[]

Since: 1.0.0

Source: src/Settings.php:789

plugin_settings()​

public function plugin_settings( $plugins )

Updates the Foundations settings with GravityMigrate settings data.

Parameters​

NameTypeDefaultDescription
$pluginsarrayPlugins settings.

Returns​

  • array

Since: 1.0.0

Source: src/Settings.php:1084

add_styles()​

public function add_styles( $styles )

Adds styles that hide GravityKit Settings sidebar and other elements.

Parameters​

NameTypeDefaultDescription
$stylesarrayInline styles to be added to the page.

Returns​

  • array

Since: 1.0.0

Source: src/Settings.php:1252

wizard_page_styles()​

public static function wizard_page_styles(): string

CSS that reshapes Foundation's settings shell for the wizard.

Static and free of WordPress so it can be asserted on directly. The rules here are load bearing rather than cosmetic: without them a long form list is cut off with no way to reach the rest of it, which is not a styling preference but content the operator cannot see.

Returns​

  • string

Since: %ver%

Source: src/Settings.php:1273