2525 SiteSettingsHomepageCount,
2626};
2727
28- NS_ENUM (NSInteger , SiteSettingsEditor) {
29- SiteSettingsEditorSelector = 0 ,
30- SiteSettingsEditorCount,
31- };
32-
3328NS_ENUM (NSInteger , SiteSettingsWriting) {
3429 SiteSettingsWritingDefaultCategory = 0 ,
3530 SiteSettingsWritingTags,
@@ -61,6 +56,7 @@ @interface SiteSettingsViewController () <UITableViewDelegate, UITextFieldDelega
6156@property (nonatomic , strong ) SettingTableViewCell *passwordTextCell;
6257#pragma mark - Writing Section
6358@property (nonatomic , strong ) SwitchTableViewCell *editorSelectorCell;
59+ @property (nonatomic , strong ) SwitchTableViewCell *themeStylesSelectorCell;
6460@property (nonatomic , strong ) SettingTableViewCell *defaultCategoryCell;
6561@property (nonatomic , strong ) SettingTableViewCell *tagsCell;
6662@property (nonatomic , strong ) SettingTableViewCell *customTaxonomiesCell;
@@ -170,9 +166,14 @@ - (NSArray *)tableSections
170166 [sections addObject: @(SiteSettingsSectionAccount)];
171167 }
172168
173- // Only add the editor section if the site is not a Simple WP.com site
169+ // Only show "Use block editor" toggle for non- Simple WP.com sites
174170 if (![GutenbergSettings isSimpleWPComSite: self .blog]) {
175- [sections addObject: @(SiteSettingsSectionEditor)];
171+ [sections addObject: @(SiteSettingsSectionBlockEditor)];
172+ }
173+
174+ // Only show theme styles toggle when GutenbergKit is enabled
175+ if ([RemoteFeature enabled: RemoteFeatureFlagNewGutenberg]) {
176+ [sections addObject: @(SiteSettingsSectionThemeStyles)];
176177 }
177178
178179 if ([self .blog supports: BlogFeatureWPComRESTAPI] && self.blog .isAdmin ) {
@@ -251,9 +252,13 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
251252 {
252253 return SiteSettingsAccountCount;
253254 }
254- case SiteSettingsSectionEditor :
255+ case SiteSettingsSectionBlockEditor :
255256 {
256- return SiteSettingsEditorCount;
257+ return 1 ;
258+ }
259+ case SiteSettingsSectionThemeStyles:
260+ {
261+ return 1 ;
257262 }
258263 case SiteSettingsSectionWriting:
259264 {
@@ -347,6 +352,20 @@ - (SwitchTableViewCell *)editorSelectorCell
347352 return _editorSelectorCell;
348353}
349354
355+ - (SwitchTableViewCell *)themeStylesSelectorCell
356+ {
357+ if (!_themeStylesSelectorCell) {
358+ _themeStylesSelectorCell = [SwitchTableViewCell new ];
359+ _themeStylesSelectorCell.name = NSLocalizedString(@" Use theme styles" , @" Option to enable theme styles in the block editor" );
360+ _themeStylesSelectorCell.flipSwitch .accessibilityIdentifier = @" useThemeStylesSwitch" ;
361+ __weak Blog *blog = self.blog ;
362+ _themeStylesSelectorCell.onChange = ^(BOOL value){
363+ [GutenbergSettings setThemeStylesEnabled: value forBlog: blog];
364+ };
365+ }
366+ return _themeStylesSelectorCell;
367+ }
368+
350369- (SettingTableViewCell *)defaultCategoryCell
351370{
352371 if (_defaultCategoryCell){
@@ -508,6 +527,11 @@ - (void)configureEditorSelectorCell
508527 [self .editorSelectorCell setOn: self .blog.isGutenbergEnabled];
509528}
510529
530+ - (void )configureThemeStylesSelectorCell
531+ {
532+ [self .themeStylesSelectorCell setOn: [GutenbergSettings isThemeStylesEnabledForBlog: self .blog]];
533+ }
534+
511535- (void )configureDefaultCategoryCell
512536{
513537 PostCategory *postCategory = [PostCategory lookupWithBlogObjectID: self .blog.objectID
@@ -526,16 +550,6 @@ - (void)configurePostsPerPageCell
526550 [self .postsPerPageCell setTextValue: self .blog.settings.postsPerPage.stringValue];
527551}
528552
529- - (UITableViewCell *)tableView : (UITableView *)tableView cellForEditorSettingsAtRow : (NSInteger )row
530- {
531- switch (row) {
532- case (SiteSettingsEditorSelector):
533- [self configureEditorSelectorCell ];
534- return self.editorSelectorCell ;
535- }
536- return nil ;
537- }
538-
539553- (UITableViewCell *)tableView : (UITableView *)tableView cellForWritingSettingsAtRow : (NSInteger )row
540554{
541555 NSInteger writingRow = [self .writingSectionRows[row] integerValue ];
@@ -665,8 +679,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
665679 case SiteSettingsSectionAccount:
666680 return [self tableView: tableView cellForAccountSettingsInRow: indexPath.row];
667681
668- case SiteSettingsSectionEditor:
669- return [self tableView: tableView cellForEditorSettingsAtRow: indexPath.row];
682+ case SiteSettingsSectionBlockEditor:
683+ [self configureEditorSelectorCell ];
684+ return self.editorSelectorCell ;
685+
686+ case SiteSettingsSectionThemeStyles:
687+ [self configureThemeStylesSelectorCell ];
688+ return self.themeStylesSelectorCell ;
670689
671690 case SiteSettingsSectionWriting:
672691 return [self tableView: tableView cellForWritingSettingsAtRow: indexPath.row];
@@ -729,8 +748,16 @@ - (NSString *)titleForHeaderInSection:(NSInteger)section
729748 headingTitle = NSLocalizedString(@" Account" , @" Title for the account section in site settings screen" );
730749 break ;
731750
732- case SiteSettingsSectionEditor:
733- headingTitle = NSLocalizedString(@" Editor" , @" Title for the editor settings section" );
751+ case SiteSettingsSectionBlockEditor:
752+ headingTitle = NSLocalizedString(@" Editor" , @" Title for the editor section in site settings screen" );
753+ break ;
754+
755+ case SiteSettingsSectionThemeStyles:
756+ // Only show "Editor" header if this is the first editor section
757+ // (i.e., if block editor section is not present)
758+ if (![self .tableSections containsObject: @(SiteSettingsSectionBlockEditor)]) {
759+ headingTitle = NSLocalizedString(@" Editor" , @" Title for the editor section in site settings screen" );
760+ }
734761 break ;
735762
736763 case SiteSettingsSectionWriting:
@@ -761,8 +788,12 @@ -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)
761788 NSInteger settingsSection = [self .tableSections[section] integerValue ];
762789 UIView *footerView = nil ;
763790 switch (settingsSection) {
764- case SiteSettingsSectionEditor:
765- footerView = [self getEditorSettingsSectionFooterView ];
791+ case SiteSettingsSectionBlockEditor:
792+ footerView = [self getBlockEditorSectionFooterView ];
793+ break ;
794+
795+ case SiteSettingsSectionThemeStyles:
796+ footerView = [self getThemeStylesSectionFooterView ];
766797 break ;
767798
768799 case SiteSettingsSectionTraffic:
0 commit comments