Skip to content

Commit

Permalink
Refactor GravityForm Module
Browse files Browse the repository at this point in the history
  • Loading branch information
R00tSquared committed Feb 6, 2019
1 parent c4f137b commit 7ba188b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 10 additions & 1 deletion src/Modules/GravityForm/GravityForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
10 changes: 5 additions & 5 deletions src/Modules/GravityForm/includes/frontend.blade.php
Original file line number Diff line number Diff line change
@@ -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 ? '<h3>'.$settings->title.'</h3>' : '' !!}
{!! gravity_form($id, $show_title, $description, false, null, $ajax, $tabIndex, false) !!}
@endif

0 comments on commit 7ba188b

Please sign in to comment.