Automattic\WooCommerce\Internal\CLI\Migrator\Platforms\Webflow

WebflowMapper::map_seoprivateWC 1.0

Map Webflow SEO fields (seo-title, seo-description) into a metafields array.

Method of the class: WebflowMapper{}

No Hooks.

Returns

Array.

Usage

// private - for code of main (parent) class only
$result = $this->map_seo( $field_data ): array;
$field_data(object) (required)
Field data.

WebflowMapper::map_seo() code WC 11.0.1

private function map_seo( object $field_data ): array {
	$meta = array();

	$title_key = 'seo-title';
	$desc_key  = 'seo-description';

	if ( isset( $field_data->{$title_key} ) && '' !== (string) $field_data->{$title_key} ) {
		$meta['global_title_tag'] = (string) $field_data->{$title_key};
	}
	if ( isset( $field_data->{$desc_key} ) && '' !== (string) $field_data->{$desc_key} ) {
		$meta['global_description_tag'] = (string) $field_data->{$desc_key};
	}

	return $meta;
}