array( 'type' => 'string', 'description' => __( 'Block name, with or without the acf/ prefix.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'name', ); } protected function output_properties(): array { return array( 'name' => array( 'type' => 'string' ), 'fields' => array( 'type' => 'array' ), 'count' => array( 'type' => 'integer' ), ); } protected function annotations(): array { return array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ); } protected function run( array $input ) { $name = Block_Repository::qualify( (string) $input['name'] ); $block = Block_Repository::get( $name ); if ( is_wp_error( $block ) ) { return $block; } $rows = Block_Repository::fields( $name ); return array( 'name' => $name, 'fields' => $rows, 'count' => count( $rows ), 'message' => array() === $rows ? __( 'That block has no field group bound to it yet.', 'acrossai-abilities-manager' ) : sprintf( /* translators: 1: number of fields, 2: block name */ __( '%1$d field(s) on "%2$s".', 'acrossai-abilities-manager' ), count( $rows ), $name ), ); } }