*/ public static function country_options(): array { $out = []; foreach ( SerperLocales::countries() as $code => $name ) { unset( $name ); $out[] = [ 'value' => $code, 'label' => SerperLocales::country_label( $code ), ]; } return $out; } /** * @return list */ public static function language_options(): array { $out = []; foreach ( SerperLocales::languages() as $code => $name ) { unset( $name ); $out[] = [ 'value' => $code, 'label' => SerperLocales::language_label( $code ), ]; } return $out; } public static function render_country( string $name, string $value ): void { self::render( $name, __( 'Country', '4wp-seo-helper' ), 'gl', $value, self::country_options() ); } public static function render_language( string $name, string $value ): void { self::render( $name, __( 'Language', '4wp-seo-helper' ), 'hl', $value, self::language_options() ); } /** * @param list $options */ public static function render( string $name, string $label, string $param, string $value, array $options ): void { $current_label = $value; foreach ( $options as $option ) { if ( $option['value'] === $value ) { $current_label = $option['label']; break; } } $list_id = $name . '_list'; ?>