array( 'type' => 'string', 'description' => __( 'Field name (e.g. hero_title) or field key (e.g. field_abc123). The name is what you see in the ACF admin.', 'acrossai-abilities-manager' ), ), 'value' => array( 'type' => array( 'string', 'number', 'boolean', 'array', 'object', 'null' ), 'description' => __( 'The new value. Shape depends on the field type: a scalar for text or number, an array of row objects for a repeater, a post ID or array of IDs for a relationship.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'selector', 'value', ); } protected function output_properties(): array { return array( 'field' => array( 'type' => 'object' ), 'updated' => array( 'type' => 'boolean' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $target = Acf_Target::resolve( $input ); if ( is_wp_error( $target ) ) { return $target; } $selector = (string) $input['selector']; $value = Slash_Input::slash( $input['value'] ?? null, $input ); $written = Field_Repository::update( $selector, $value, $target ); if ( is_wp_error( $written ) ) { return $written; } $field = Field_Repository::describe( $selector, $target ); return array( 'field' => is_wp_error( $field ) ? null : $field, 'updated' => true, 'message' => sprintf( /* translators: 1: field name, 2: target description */ __( 'Updated "%1$s" on %2$s.', 'acrossai-abilities-manager' ), $selector, Acf_Target::describe( $input ) ), ); } }