PaymentForm::TAB, 'label' => esc_html__('Payment', 'daytidy'), 'icon' => 'wui-icon daytidy-admin-icon wui-icon--payment', ]; return $tabs; } /** * @param string $content * @param SettingsMenu $menu * @return string */ public function form(string $content, SettingsMenu $menu): string { // Generate output of the Tab if ($menu->tab === PaymentForm::TAB) { // Config $config = (new PaymentOptions())->get(); if (Arr::not($config)) $config = []; // Payment Gateways $gateways = Gateways::all(); // Independent Gateway $independents = []; $cart_integrated = []; foreach ($gateways as $gateway) { if (!in_array($gateway->type(), [PaymentGateway::INDEPENDENT, PaymentGateway::CART_INTEGRATED], true)) continue; $item = [ 'title_class' => Html::get_daytidy_class('title--sm', 'admin') . ' daytidy-leading-snug', 'title' => '' . $gateway->name() . '' . ($gateway->enabled() ? '' : '') . '', 'content' => $gateway->config(), ]; if ($gateway->type() === PaymentGateway::CART_INTEGRATED) $cart_integrated[] = $item; else $independents[] = $item; } // Render Content $content = $menu->view()->render('menus.settings.tabs.payment-form', compact( 'config', 'gateways', 'independents', 'cart_integrated' )); } return $content; } }