*/ public static function action( string $label, string $module, ?string $field = null, $suggest = null, string $subtab = '', ?string $focus_module = null ): array { $action = array( 'label' => $label, 'module' => $module, ); if ( '' !== $subtab ) { $action['subtab'] = $subtab; } if ( null !== $field && '' !== $field ) { $action['focus'] = ( $focus_module ?? $module ) . ':' . $field; } if ( null !== $suggest && '' !== $suggest ) { $action['suggest'] = self::stringify( $suggest ); } return $action; } /** * Render a value the way the link carries it. * * Booleans become 1/0 rather than PHP's "" for false — an empty string * would be dropped as "no suggestion", turning "we recommend turning * this off" into no recommendation at all. * * @param mixed $value Any scalar or list. */ private static function stringify( $value ): string { if ( is_bool( $value ) ) { return $value ? '1' : '0'; } if ( is_array( $value ) ) { return implode( ',', array_map( 'strval', $value ) ); } return (string) $value; } }