diff --git a/wire/core/Process.php b/wire/core/Process.php index f35d3a2f..074da9d7 100644 --- a/wire/core/Process.php +++ b/wire/core/Process.php @@ -151,6 +151,19 @@ abstract class Process extends WireData implements Module { */ public function ___executed($method) { } + /* + * Add this method to your Process module if you want a catch-all fallback + * + * It should check $input->urlSegment1 for the method that was requested. + * This is commented out here since it is not used by Process modules unless manually added. + * + * @since 3.0.133 + * @return string|array + * + public function ___executeUnknown() { + } + */ + /** * Get a value stored in this Process * diff --git a/wire/core/ProcessController.php b/wire/core/ProcessController.php index 8bd33ea1..8a182cd4 100644 --- a/wire/core/ProcessController.php +++ b/wire/core/ProcessController.php @@ -291,12 +291,16 @@ class ProcessController extends Wire { } } - if($forceFail) return ''; - if($method === 'executed') return ''; - - if(method_exists($process, $method)) return $method; - if(method_exists($process, "___$method")) return $method; - if($process->hasHook($method . '()')) return $method; + if(!$forceFail) { + if($method === 'executed') return ''; + if(method_exists($process, $method)) return $method; + if(method_exists($process, "___$method")) return $method; + if($process->hasHook($method . '()')) return $method; + } + + // fallback to the unknown, if there is an unknown (you never know) + $method = 'executeUnknown'; + if(method_exists($process, $method) || method_exists($process, "___$method")) return $method; return ''; }