loadVars(); parent::render(); } protected function loadVars(): void { $secure = new SecureOptions(); $business = $secure->get_selected_business(); if ( empty( $business['waba_id'] ) ) { $this->vars['error'] = sprintf( /* translators: %s: URL to the plugin settings page. */ __( 'No WhatsApp Business Account was selected. Go to Afroit Messaging Workflows for WooCommerce > Settings to setup your WhatsApp Business Account.', 'afroit-messaging-workflows' ), esc_url( HubPage::url( array( 'tab' => 'settings' ) ) ) ); return; } $paging = array(); $after = Request::get( 'cursor_after', '' ); if ( '' !== $after ) { $paging['after'] = $after; } $before = Request::get( 'cursor_before', '' ); if ( '' !== $before ) { $paging['before'] = $before; } $response = ( new MetaMessaging() )->getMessageTemplates( $business['waba_id'], $paging ); if ( $response === false ) { $this->vars['error'] = __( 'Failed to get message templates. Please try again.', 'afroit-messaging-workflows' ); return; } $this->vars['templates'] = isset( $response['data'] ) ? $response['data'] : array(); $this->vars['paging'] = isset( $response['paging'] ) ? $response['paging'] : array(); $this->vars['base_url'] = HubPage::url( array( 'tab' => 'templates' ) ); } protected function getViewPath() { return AFROMEWO_PLUGIN_DIR . 'includes/Admin/Automation/Views/templates.php'; } }