Skip to content

Commit

Permalink
Remove undefined settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
doekenorg committed Oct 17, 2024
1 parent 76ca8a7 commit 9e71d4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
20 changes: 12 additions & 8 deletions future/includes/class-gv-permalinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ private function permalink_settings(): array {
* @return array The full settings array.
*/
public function add_permalink_settings( array $settings ): array {
if ( ! isset( $settings[ Plugin_Settings::SETTINGS_PLUGIN_ID ] ) ) {
return $settings;
}

$settings[ Plugin_Settings::SETTINGS_PLUGIN_ID ]['sections'][] = [
'title' => esc_html__( 'Permalinks', 'gk-gravityview' ),
'description' => esc_html__(
Expand Down Expand Up @@ -513,33 +517,33 @@ public function add_view_settings_scripts(): void {
if ( value.length === 0 ) {
return '';
}
if (value.length < 3) {
return '[ERROR_AT_LEAST_3]';
}
if ( ! value.match( /{entry_id}/s ) ) {
return '[ERROR_MISSING_ENTRY_ID]';
}
if ( ! value.match( /(^[a-zA-Z0-9_{}\-]*$)/s ) ) {
return '[ERROR_NO_SPACES]';
}
return '';
}
$( '#gravityview_se_single_entry_slug' ).on( 'input', function () {
const value = $( this ).val();
const parent = $( this ).closest( 'label' );
const error = getErrorMessage( value );
const is_valid = '' === error;
parent.toggleClass( 'form-invalid form-required', ! is_valid );
$( '#publish ')
.attr( 'disabled', ! is_valid )
.toggleClass( 'disabled' , ! is_valid );
parent.find( 'span.error-message' ).remove();
if ( !is_valid ) {
parent.append( $( '<span class="error-message" style="margin-top:2px; font-size: 12px">' + error + '</span>' ) );
Expand Down Expand Up @@ -723,7 +727,7 @@ public function add_global_settings_scripts( array $scripts ): array {
document.querySelectorAll( `[data-slug-preview="\${e.target.name}"]` ).forEach( ( element ) => {
const default_value = element.dataset.slugDefault ?? 'unknown';
element.innerHTML = ( e.target.value || default_value );
if ( 'entry_slug' === e.target.name ) {
element.innerHTML = element.innerHTML.replaceAll( '{entry_id}', '123' );
}
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Beautifully display your Gravity Forms entries. Learn more on [gravitykit.com](h

== Changelog ==

= develop =

Fixed: Settings paged showed an undefined settings tab when the GravityView Settings tab was disabled.

= 2.30.1 on October 15, 2024 =

This hotfix release resolves an issue with the Multiple Forms extension.
Expand Down

0 comments on commit 9e71d4c

Please sign in to comment.