$model * @param int $post_id * @param string $subtree_id * @return array */ protected function analyze( array $model, int $post_id, string $subtree_id ): array { $findings = array(); $legacy = array(); foreach ( $model['rows'] as $row ) { if ( 'section' === (string) $row['el_type'] ) { $legacy[] = (string) $row['id']; } if ( (int) $row['lane_count'] < 3 ) { continue; } $sizes = Design_Model::lane_sizes( $row ); if ( array() === $sizes || ( max( $sizes ) - min( $sizes ) ) > 2 ) { continue; } $findings[] = array( 'type' => 'grid_candidate', 'row_id' => (string) $row['id'], 'lane_count' => (int) $row['lane_count'], 'severity' => 'low', 'message' => sprintf( /* translators: 1: row id, 2: lane count */ __( 'Row %1$s holds %2$d equal peer lanes, which Elementor recommends building as a Container Grid rather than guessing Flexbox widths.', 'acrossai-abilities-manager' ), (string) $row['id'], (int) $row['lane_count'] ), ); } if ( array() !== $legacy ) { $findings[] = array( 'type' => 'legacy_section', 'rows' => $legacy, 'severity' => 'low', 'message' => sprintf( /* translators: %d: number of rows */ __( '%d rows still use the legacy section/column structure, which cannot use Grid until converted to containers.', 'acrossai-abilities-manager' ), count( $legacy ) ), ); } return array( 'findings' => $findings, 'recommendations' => array() === $findings ? array() : array( array( 'suggestion' => __( 'Equal peer lanes are what Container Grid is for: one column count instead of a width per lane, and one place to change it per breakpoint.', 'acrossai-abilities-manager' ) ), ), 'score' => max( 0, 100 - count( $findings ) * 10 ), ); } }