['required', 'string'], 'ids' => ['required', 'array'], ]; } public function messages() { return [ 'taxonomy.required' => 'taxonomy is required.', 'ids.required' => 'ids is required.', 'ids.array' => 'ids must be an array of term ids.', ]; } /** * The taxonomy from the URL, or an empty string when it is not one this * plugin lets an admin order. * * The allowlist is the boundary: without it the route would write order * meta onto terms of any taxonomy on the site. */ public function orderableTaxonomy(): string { $taxonomy = \is_string($this->taxonomy) ? $this->taxonomy : ''; return TermOrderService::isOrderable($taxonomy) ? $taxonomy : ''; } /** * Term ids in their new order, deduplicated. * * A repeated id would consume two positions and push everything after it * out by one, so only the first occurrence counts. * * @return int[] */ public function orderedIds(): array { $ids = \is_array($this->ids) ? $this->ids : []; return array_values(array_unique(array_filter(array_map('absint', $ids)))); } }