array( 'type' => 'string', 'description' => __( 'Repeater or flexible-content field name (e.g. cards) or field key.', 'acrossai-abilities-manager' ), ), 'index' => array( 'type' => 'integer', 'minimum' => 1, 'description' => __( '1-based row index, matching ACF\'s own API. The first row is 1, not 0.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'selector', 'index', ); } protected function output_properties(): array { return array( 'removed_index' => array( 'type' => 'integer' ), 'row_count' => array( 'type' => 'integer' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => false, ); } protected function run( array $input ) { $target = Acf_Target::resolve( $input ); if ( is_wp_error( $target ) ) { return $target; } $selector = (string) $input['selector']; $typed = Field_Repository::assert_type( $selector, $target, array( 'flexible_content' ) ); if ( is_wp_error( $typed ) ) { return $typed; } $index = (int) $input['index']; $range = Field_Repository::assert_index( $index, Field_Repository::row_count( $selector, $target ) ); if ( is_wp_error( $range ) ) { return $range; } $removed = Field_Repository::delete_row( $selector, $index, $target ); if ( is_wp_error( $removed ) ) { return $removed; } return array( 'removed_index' => $index, 'row_count' => Field_Repository::row_count( $selector, $target ), 'message' => sprintf( /* translators: 1: row index, 2: field name */ __( 'Layout %1$d removed from "%2$s".', 'acrossai-abilities-manager' ), $index, $selector ), ); } }