getAuthContext(); } final protected function addActionPaths(string $path) { $this->_action_paths[] = $path; } final protected function getActionPaths($isArray = true, $delimeter = DIRECTORY_SEPARATOR): array|string { return $isArray ? $this->_action_paths : implode($delimeter, $this->_action_paths); } final protected function addViewDatas(string $key, mixed $value) { $this->_viewDatas[$key] = $value; } final protected function getViewDatas(?string $key = null): mixed { if ($key === null) { return $this->_viewDatas; } return $this->_viewDatas[$key] ?? null; } //공통 필수기능 //필수함수 //사용자정의 함수 protected function action_init_process(string $action): void { $this->addViewDatas('action', $action); $this->addViewDatas('authContext', $this->getAuthContext()); $this->addViewDatas('classPath', $this->service->getClassPaths(false)); } protected function action_modal_process(string $message): string { return " "; } protected function action_redirect_process(string $redirect_url, string $message): RedirectResponse { return redirect()->to($redirect_url)->with('message', $message); } protected function action_render_process(array $view_paths, string $view_file, array $viewDatas): string { $lastest_path = array_pop($view_paths); //paths는 마지막을 뺀 앞단까지만 남음 // ✅ 중간 안내 화면으로 // return view('posts/success_redirect', [ // 'message' => '게시글이 성공적으로 등록되었습니다.', // 'redirectUrl' => route_to('posts_list') // ]); // 중요한 작업 (결제 완료, 오류 등) → “로딩 페이지(View)”로 안내 후 JS redirect $full_path = implode(DIRECTORY_SEPARATOR, $view_paths); $final_path = $this->request->getVar('ActionTemplate'); if ($final_path) { $full_path .= DIRECTORY_SEPARATOR . $final_path; } // else { // $full_path .= DIRECTORY_SEPARATOR. $lastest_path; // } $view_datas = [ ...$viewDatas, 'forms' => ['attributes' => ['method' => "post",], 'hiddens' => []], ]; helper(['form', __FUNCTION__]); return view($full_path . DIRECTORY_SEPARATOR . $view_file, ['viewDatas' => $view_datas]); } }