agencyPlugin = $agencyPlugin; Hook::add('Schema::get::' . $this::class, [$this, 'addToSchema']); } public function validate(array $props): array { /** @var PKPSchemaService $schemaService */ $schemaService = Services::get('schema'); $validator = ValidatorFactory::make( $props, $schemaService->getValidationRules($this::class, []), ); // Check required ValidatorFactory::required( $validator, EntityWriteInterface::VALIDATE_ACTION_EDIT, $schemaService->getRequiredProps($this::class), $schemaService->getMultilingualProps($this::class), [], '', ); $this->addValidationChecks($validator, $props); if ($validator->fails()) { $errors = $schemaService->formatValidationErrors($validator->errors()); } return $errors ?? []; } abstract public function getSchema(): \stdClass; public function addToSchema($hookname, $args): bool { $schema = &$args[0]; $schema = $this->getSchema(); return Hook::CONTINUE; } /** * Gets plugin-specific settings field to inject into DOI registration settings form. * * @return Field[] */ abstract public function getFields(Context $context): array; /** * Overwrite to add additional, plugin-specific validation checks */ protected function addValidationChecks(Validator &$validator, array $props): void { } }