From 7ba188bf65dbf072178c635a1bef79872b557a06 Mon Sep 17 00:00:00 2001 From: BufferOverNo Date: Wed, 6 Feb 2019 16:11:29 +0000 Subject: [PATCH] Refactor GravityForm Module --- src/Modules/GravityForm/GravityForm.php | 11 ++++++++++- src/Modules/GravityForm/includes/frontend.blade.php | 10 +++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Modules/GravityForm/GravityForm.php b/src/Modules/GravityForm/GravityForm.php index 68a9276..6bbf037 100644 --- a/src/Modules/GravityForm/GravityForm.php +++ b/src/Modules/GravityForm/GravityForm.php @@ -35,9 +35,18 @@ public static function register(): void 'label' => __('Form', 'fabric'), 'options' => $helper->getGravityForms(), ], + 'show_custom_title' => [ + 'type' => 'select', + 'label' => __('Display custom title', 'fabric'), + 'default' => '0', + 'options' => [ + '0' => __('No', 'fabric'), + '1' => __('Yes', 'fabric'), + ], + ], 'show_title' => [ 'type' => 'select', - 'label' => __('Display title', 'fabric'), + 'label' => __('Display form title', 'fabric'), 'default' => '0', 'options' => [ '0' => __('No', 'fabric'), diff --git a/src/Modules/GravityForm/includes/frontend.blade.php b/src/Modules/GravityForm/includes/frontend.blade.php index 9e420fd..292c955 100644 --- a/src/Modules/GravityForm/includes/frontend.blade.php +++ b/src/Modules/GravityForm/includes/frontend.blade.php @@ -1,11 +1,11 @@ @php $id = absint($settings->form_id); - $title = (bool) ($settings->show_title ? true : false); - $description = (bool) ($settings->show_descr ? true : false); - $ajax = (bool) ($settings->enable_ajax ? true : false); - $tabIndex = (int) ($settings->tab_index ? 1 : 0); + $ajax = (bool) $settings->enable_ajax; + $tabIndex = (int) $settings->tab_index; + $show_title = (bool) $settings->show_title; @endphp @if(!empty($settings->form_id)) - {!! gravity_form($id, $title, $description, false, null, $ajax, $tabIndex, false) !!} + {!! !empty($settings->title) && $settings->show_custom_title ? '

'.$settings->title.'

' : '' !!} + {!! gravity_form($id, $show_title, $description, false, null, $ajax, $tabIndex, false) !!} @endif