original_string: protected function addThemeColorPicker(FieldList $fields)
      {
          // Only show theme colour selector if enabled
          if (!$this->owner->config()->get('enable_theme_color_picker')) {
              return $this;
          }
  
          $fonts = $this->owner->config()->get('theme_fonts');
  
          // Import each font via the google fonts api to render font preview
          foreach ($fonts as $fontTitle) {
              $fontFamilyName = str_replace(' ', '+', $fontTitle);
              Requirements::css("//fonts.googleapis.com/css?family=$fontFamilyName");
          }
  
          $fields->addFieldsToTab(
              'Root.ThemeOptions',
              [
                  FontPickerField::create(
                      'MainFontFamily',
                      _t(
                          __CLASS__ . '.MainFontFamily',
                          'Main font family'
                      ),
                      $fonts
                  ),
                   ColorPickerField::create(
                       'HeaderBackground',
                       _t(
                           __CLASS__ . '.HeaderBackground',
                           'Header background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'NavigationBarBackground',
                       _t(
                           __CLASS__ . '.NavigationBarBackground',
                           'Navigation bar background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'CarouselBackground',
                       _t(
                           __CLASS__ . '.CarouselBackground',
                           'Carousel background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   )->setDescription(
                       _t(
                           __CLASS__ . '.CarouselBackgroundDescription',
                           'The background colour of the carousel when there is no image set.'
                       )
                   ),
                   ColorPickerField::create(
                       'FooterBackground',
                       _t(
                           __CLASS__ . '.FooterBackground',
                           'Footer background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'light-grey',
                           'white',
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'AccentColor',
                       _t(
                           __CLASS__ . '.AccentColor',
                           'Accent colour'
                       ),
                       $this->getThemeOptionsExcluding([
                           'light-grey',
                           'white',
                           'default-background',
                       ])
                   )->setDescription(
                       _t(
                           __CLASS__ . '.AccentColorDescription',
                           'Affects colour of buttons, current navigation items, etc. '.
                           'Please ensure sufficient contrast with background colours.'
                       )
                   ),
                   ColorPickerField::create(
                       'TextLinkColor',
                       _t(
                           __CLASS__ . '.TextLinkColor',
                           'Text link colour'
                       ),
                       $this->getThemeOptionsExcluding([
                           'black',
                           'light-grey',
                           'dark-grey',
                           'white',
                           'default-background',
                       ])
                   ),
              ]
          );
  
          return $this;
      }
code: protected function addThemeColorPicker(FieldList $fields)
      {
          // Only show theme colour selector if enabled
          if (!$this->owner->config()->get('enable_theme_color_picker')) {
              return $this;
          }
  
          $fonts = $this->owner->config()->get('theme_fonts');
  
          // Import each font via the google fonts api to render font preview
          foreach ($fonts as $fontTitle) {
              $fontFamilyName = str_replace(' ', '+', $fontTitle);
              Requirements::css("//fonts.googleapis.com/css?family=$fontFamilyName");
          }
  
          $fields->addFieldsToTab(
              'Root.ThemeOptions',
              [
                  FontPickerField::create(
                      'MainFontFamily',
                      _t(
                          __CLASS__ . '.MainFontFamily',
                          'Main font family'
                      ),
                      $fonts
                  ),
                   ColorPickerField::create(
                       'HeaderBackground',
                       _t(
                           __CLASS__ . '.HeaderBackground',
                           'Header background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'NavigationBarBackground',
                       _t(
                           __CLASS__ . '.NavigationBarBackground',
                           'Navigation bar background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'CarouselBackground',
                       _t(
                           __CLASS__ . '.CarouselBackground',
                           'Carousel background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'default-accent',
                       ])
                   )->setDescription(
                       _t(
                           __CLASS__ . '.CarouselBackgroundDescription',
                           'The background colour of the carousel when there is no image set.'
                       )
                   ),
                   ColorPickerField::create(
                       'FooterBackground',
                       _t(
                           __CLASS__ . '.FooterBackground',
                           'Footer background'
                       ),
                       $this->getThemeOptionsExcluding([
                           'light-grey',
                           'white',
                           'default-accent',
                       ])
                   ),
                   ColorPickerField::create(
                       'AccentColor',
                       _t(
                           __CLASS__ . '.AccentColor',
                           'Accent colour'
                       ),
                       $this->getThemeOptionsExcluding([
                           'light-grey',
                           'white',
                           'default-background',
                       ])
                   )->setDescription(
                       _t(
                           __CLASS__ . '.AccentColorDescription',
                           'Affects colour of buttons, current navigation items, etc. '.
                           'Please ensure sufficient contrast with background colours.'
                       )
                   ),
                   ColorPickerField::create(
                       'TextLinkColor',
                       _t(
                           __CLASS__ . '.TextLinkColor',
                           'Text link colour'
                       ),
                       $this->getThemeOptionsExcluding([
                           'black',
                           'light-grey',
                           'dark-grey',
                           'white',
                           'default-background',
                       ])
                   ),
              ]
          );
  
          return $this;
      }
code_tokens: protected function addThemeColorPicker ( FieldList $ fields ) { // Only show theme colour selector if enabled if ( ! $ this -> owner -> config ( ) -> get ( 'enable_theme_color_picker' ) ) { return $ this ; } $ fonts = $ this -> owner -> config ( ) -> get ( 'theme_fonts' ) ; // Import each font via the google fonts api to render font preview foreach ( $ fonts as $ fontTitle ) { $ fontFamilyName = str_replace ( ' ' , '+' , $ fontTitle ) ; Requirements :: css ( "//fonts.googleapis.com/css?family=$fontFamilyName" ) ; } $ fields -> addFieldsToTab ( 'Root.ThemeOptions' , [ FontPickerField :: create ( 'MainFontFamily' , _t ( __CLASS__ . '.MainFontFamily' , 'Main font family' ) , $ fonts ) , ColorPickerField :: create ( 'HeaderBackground' , _t ( __CLASS__ . '.HeaderBackground' , 'Header background' ) , $ this -> getThemeOptionsExcluding ( [ 'default-accent' , ] ) ) , ColorPickerField :: create ( 'NavigationBarBackground' , _t ( __CLASS__ . '.NavigationBarBackground' , 'Navigation bar background' ) , $ this -> getThemeOptionsExcluding ( [ 'default-accent' , ] ) ) , ColorPickerField :: create ( 'CarouselBackground' , _t ( __CLASS__ . '.CarouselBackground' , 'Carousel background' ) , $ this -> getThemeOptionsExcluding ( [ 'default-accent' , ] ) ) -> setDescription ( _t ( __CLASS__ . '.CarouselBackgroundDescription' , 'The background colour of the carousel when there is no image set.' ) ) , ColorPickerField :: create ( 'FooterBackground' , _t ( __CLASS__ . '.FooterBackground' , 'Footer background' ) , $ this -> getThemeOptionsExcluding ( [ 'light-grey' , 'white' , 'default-accent' , ] ) ) , ColorPickerField :: create ( 'AccentColor' , _t ( __CLASS__ . '.AccentColor' , 'Accent colour' ) , $ this -> getThemeOptionsExcluding ( [ 'light-grey' , 'white' , 'default-background' , ] ) ) -> setDescription ( _t ( __CLASS__ . '.AccentColorDescription' , 'Affects colour of buttons, current navigation items, etc. ' . 'Please ensure sufficient contrast with background colours.' ) ) , ColorPickerField :: create ( 'TextLinkColor' , _t ( __CLASS__ . '.TextLinkColor' , 'Text link colour' ) , $ this -> getThemeOptionsExcluding ( [ 'black' , 'light-grey' , 'dark-grey' , 'white' , 'default-background' , ] ) ) , ] ) ; return $ this ; }
docstring: Add fields for selecting the font theme colour for different areas of the site.
  
  @param  FieldList $fields
  @return $this
docstring_tokens: Add fields for selecting the font theme colour for different areas of the site .