Configure the web options tab using the settings API.
504394
function init() {
		$_option = 'pressbooks_theme_options_' . $this->getSlug();
		$_page = $_option;
		$_section = $this->getSlug() . '_options_section';
		$meta = new Metadata();

		if ( false === get_option( $_option ) ) {
			add_option( $_option, $this->defaults );
		}

		add_settings_section(
			$_section,
			$this->getTitle(),
			[ $this, 'display' ],
			$_page
		);

		add_settings_field(
			'social_media',
			__( 'Enable Social Media', 'pressbooks' ),
			[ $this, 'renderSocialMediaField' ],
			$_page,
			$_section,
			[
				__( 'Add buttons to cover page and each chapter so that readers may share links to your book through social media: Facebook, Twitter, Google+', 'pressbooks' ),
			]
		);

		add_settings_field(
			'webbook_width',
			__( 'Webbook Width', 'pressbooks' ),
			[ $this, 'renderWebbookWidthField' ],
			$_page,
			$_section,
			[
				'30em' => __( 'Narrow', 'pressbooks' ),
				'40em' => __( 'Standard', 'pressbooks' ),
				'48em' => __( 'Wide', 'pressbooks' ),
				'label_for' => 'webbook_width',
			]
		);

		add_settings_field(
			'paragraph_separation',
			__( 'Paragraph Separation', 'pressbooks' ),
			[ $this, 'renderParagraphSeparationField' ],
			$_page,
			$_section,
			[
				'indent' => __( 'Indent paragraphs', 'pressbooks' ),
				'skiplines' => __( 'Skip lines between paragraphs', 'pressbooks' ),
			]
		);

		add_settings_field(
			'part_title',
			__( 'Display Part Title', 'pressbooks' ),
			[ $this, 'renderPartTitle' ],
			$_page,
			$_section,
			[
				__( 'Display the Part title on each chapter', 'pressbooks' ),
			]
		);

		if ( Container::get( 'Styles' )->hasBuckram() ) {
			add_settings_field(
				'collapse_sections',
				__( 'Collapse Sections', 'pressbooks' ),
				[ $this, 'renderCollapseSections' ],
				$_page,
				$_section,
				[
					__( 'Collapse sections within front matter, chapters, and back matter', 'pressbooks' ),
				]
			);
		}

		if ( get_post_meta( $meta->getMetaPostId(), 'pb_is_based_on', true ) ) {
			add_settings_field(
				'enable_source_comparison',
				__( 'Enable Source Comparison', 'pressbooks' ),
				[ $this, 'renderEnableSourceComparison' ],
				$_page,
				$_section,
				[
					__( 'Add comparison tool to the end of each front matter, part, chapter, and back matter', 'pressbooks' ),
					__( 'Allows readers to compare content with the original book from which it was cloned.', 'pressbooks' ),
				]
			);
		}

		/**
		 * Add custom settings fields.
		 *
		 * @since 3.9.7
		 *
		 * @param string $arg1
		 * @param string $arg2
		 */
		do_action( 'pb_theme_options_web_add_settings_fields', $_page, $_section );

		register_setting(
			$_page,
			$_option,
			[ $this, 'sanitize' ]
		);
	}
205195
protected function set_choices() {
		if ( ! isset( $this->choices['language'] ) ) {
			return;
		}
		$language = $this->choices['language'];
		switch ( $language ) {
			case 'json':
			case 'xml':
				$language = 'application/' . $language;
				break;
			case 'http':
				$language = 'message/' . $language;
				break;
			case 'js':
			case 'javascript':
				$language = 'text/javascript';
				break;
			case 'txt':
				$language = 'text/plain';
				break;
			case 'css':
			case 'jsx':
			case 'html':
				$language = 'text/' . $language;
				break;
			default:
				$language = ( 'js' === $language ) ? 'javascript' : $language;
				$language = ( 'htm' === $language ) ? 'html' : $language;
				$language = ( 'yml' === $language ) ? 'yaml' : $language;
				$language = 'text/x-' . $language;
				break;
		}
		if ( ! isset( $this->editor_settings['codemirror'] ) ) {
			$this->editor_settings['codemirror'] = [];
		}
		if ( ! isset( $this->editor_settings['codemirror']['mode'] ) ) {
			$this->editor_settings['codemirror']['mode'] = $language;
		}

		if ( 'text/x-scss' === $this->editor_settings['codemirror']['mode'] ) {
			$this->editor_settings['codemirror'] = array_merge(
				$this->editor_settings['codemirror'],
				[
					'lint'              => false,
					'autoCloseBrackets' => true,
					'matchBrackets'     => true,
				]
			);
		}
	}
335703
def config_table(settings):
    """"""
    table = formatting.KeyValueTable(['name', 'value'])
    table.align['name'] = 'r'
    table.align['value'] = 'l'
    table.add_row(['Username', settings['username'] or 'not set'])
    table.add_row(['API Key', settings['api_key'] or 'not set'])
    table.add_row(['Endpoint URL', settings['endpoint_url'] or 'not set'])
    table.add_row(['Timeout', settings['timeout'] or 'not set'])
    return table
375670
def initOptions(self, options):
        
        self.setAutoIndent(             options.value('autoIndent'))
        self.setIndentationsUseTabs(    options.value('indentationsUseTabs'))
        self.setTabIndents(             options.value('tabIndents'))
        self.setTabWidth(               options.value('tabWidth'))
        
        self.setCaretLineVisible(       options.value('showCaretLine'))
        self.setShowWhitespaces(        options.value('showWhitespaces'))
        self.setMarginLineNumbers( 0,   options.value('showLineNumbers'))
        self.setIndentationGuides(      options.value('showIndentations'))
        self.setEolVisibility(          options.value('showEndlines'))
        
        if options.value('showLimitColumn'):
            self.setEdgeMode(self.EdgeLine)
            self.setEdgeColumn(options.value('limitColumn'))
        else:
            self.setEdgeMode(self.EdgeNone)
        
        if options.value('showLineWrap'):
            self.setWrapMode(self.WrapWord)
        else:
            self.setWrapMode(self.WrapNone)
        
        # set the autocompletion source
        if options.value('autoComplete'):
            self.setAutoCompletionSource(QsciScintilla.AcsAll)
        else:
            self.setAutoCompletionSource(QsciScintilla.AcsNone)
        
        self.setAutoCompletionThreshold(options.value('autoCompleteThreshold'))
        
        # update the font information
        font = options.value('documentFont')
        font.setPointSize(options.value('documentFontSize'))
        self.setFont(font)
        
        # udpate the lexer
        lexer = self.lexer()
        if lexer:
            lexer.setFont(font)
        
        # create the margin font option
        mfont = options.value('documentMarginFont')
        mfont.setPointSize(font.pointSize() - 2)
        self.setMarginsFont(mfont)
        self.setMarginWidth(0, QFontMetrics(mfont).width('0000000') + 5)
602870
protected function _setOptions()
    {
        if (!is_null($this->getHeader())) {
            $this->_setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
        }
        $this->_setOpt(CURLOPT_URL, $this->getUrl());

        if ($this->getMethod() == "POST") {
            $this->_setOpt(CURLOPT_POST, 1);
            $this->_setOpt(CURLOPT_POSTFIELDS, $this->getQuery());
        }

        $options = $this->getOptions();
        if (count($options)) {
            foreach ($options as $name => $mValue) {
                $this->_setOpt(constant($name), $mValue);
            }
        }
    }
1079331
def configure(self, default_settings=global_settings, **options):
        
        if self._wrapped is not empty:
            raise RuntimeError('Settings already configured.')
        holder = UserSettingsHolder(default_settings)
        for name, value in options.items():
            setattr(holder, name, value)
        self._wrapped = holder
102055
function setOptions( options ) {
		if ( !options.hasOwnProperty( 'objectMode' ) ) {
			options.objectMode = false;
		}
		if ( !options.hasOwnProperty( 'encoding' ) ) {
			options.encoding = null;
		}
	}
1014963
function(element, options) {
        var self = this;

        element = this.setElement(element).attr('role', 'tablist');
        options = this.setOptions(options, element);

        // Find headers and cache the index of each header and set ARIA attributes
        this.headers = element.find(this.ns('header')).each(function(index) {
            $(this)
                .data('accordion-index', index)
                .attr({
                    role: 'tab',
                    id: self.id('header', index)
                })
                .aria({
                    controls: self.id('section', index),
                    selected: false,
                    expanded: false
                });
        });

        // Find sections and cache the height so we can use for sliding and set ARIA attributes
        this.sections = element.find(this.ns('section')).each(function(index) {
            $(this)
                .attr({
                    role: 'tabpanel',
                    id: self.id('section', index)
                })
                .aria('labelledby', self.id('header', index))
                .conceal();
        });

        // Set events
        this.addEvents([
            ['horizontalresize', 'window', $.debounce(this.calculate.bind(this))],
            ['{mode}', 'element', 'onShow', this.ns('header')]
        ]);

        // Initialize
        this.initialize();

        // Jump to the index on page load
        this.calculate();
        this.jump(options.defaultIndex);
    }
1992
function () {
        var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;
        var value = self.state.get('value') || '';
        var icon, text, openBtnHtml = '', extraAttrs = '', statusHtml = '';

        if ("spellcheck" in settings) {
          extraAttrs += ' spellcheck="' + settings.spellcheck + '"';
        }

        if (settings.maxLength) {
          extraAttrs += ' maxlength="' + settings.maxLength + '"';
        }

        if (settings.size) {
          extraAttrs += ' size="' + settings.size + '"';
        }

        if (settings.subtype) {
          extraAttrs += ' type="' + settings.subtype + '"';
        }

        statusHtml = '<i id="' + id + '-status" class="mce-status mce-ico" style="display: none"></i>';

        if (self.disabled()) {
          extraAttrs += ' disabled="disabled"';
        }

        icon = settings.icon;
        if (icon && icon != 'caret') {
          icon = prefix + 'ico ' + prefix + 'i-' + settings.icon;
        }

        text = self.state.get('text');

        if (icon || text) {
          openBtnHtml = (
            '<div id="' + id + '-open" class="' + prefix + 'btn ' + prefix + 'open" tabIndex="-1" role="button">' +
            '<button id="' + id + '-action" type="button" hidefocus="1" tabindex="-1">' +
            (icon != 'caret' ? '<i class="' + icon + '"></i>' : '<i class="' + prefix + 'caret"></i>') +
            (text ? (icon ? ' ' : '') + text : '') +
            '</button>' +
            '</div>'
          );

          self.classes.add('has-open');
        }

        return (
          '<div id="' + id + '" class="' + self.classes + '">' +
          '<input id="' + id + '-inp" class="' + prefix + 'textbox" value="' +
          self.encode(value, false) + '" hidefocus="1"' + extraAttrs + ' placeholder="' +
          self.encode(settings.placeholder) + '" />' +
          statusHtml +
          openBtnHtml +
          '</div>'
        );
      }
1351163
function setConfig (options) {
  Object.keys(options).forEach((option) => {
    if (config[option] !== undefined) {
      config[option] = options[option]
    }
  })
}
228388
protected function configure()
    {
        $this->setDescription($this->shortDesc);

        foreach($this->paramsArray as $nameParam => $arrayOptions){
            if($arrayOptions['optional']){
                $this->addOption($nameParam, null, InputOption::VALUE_OPTIONAL, $arrayOptions['comment'], null);
            }
            else {
                $this->addOption($nameParam, null, InputOption::VALUE_REQUIRED, $arrayOptions['comment'], null);
            } 
        }
    }
355238
def set_options(self, **options):
        
        self.interactive = False
        self.verbosity = options['verbosity']
        self.symlink = ""
        self.clear = False
        ignore_patterns = []
        self.ignore_patterns = list(set(ignore_patterns))
        self.page_themes_updated = 0
        self.skins_updated = 0
314926
protected function _setOptions()
    {
        if (!is_null($this->getHeader())) {
            $this->_setOpt(CURLOPT_HTTPHEADER, $this->getHeader());
        }
        $this->_setOpt(CURLOPT_URL, $this->getUrl());

        if ($this->getMethod() == "POST") {
            $this->_setOpt(CURLOPT_POST, 1);
            $this->_setOpt(CURLOPT_POSTFIELDS, $this->_formParamsForPost($this->getParameters()));
        }

        $aOptions = $this->getOptions();
        if (count($aOptions)) {
            foreach ($aOptions as $sName => $mValue) {
                $this->_setOpt(constant($sName), $mValue);
            }
        }
    }
882515
def set_options(opts = {})
      @wsdl           = opts[:wsdl]           || Settings.session.wsdl
      @endpoint       = opts[:endpoint]       || Settings.session.endpoint
      @soap_log       = opts[:soap_log]       || Settings.session.soap_log
      @soap_logger    = opts[:soap_logger]    || Settings.session.soap_logger
      @soap_log_level = opts[:soap_log_level] || Settings.session.soap_log_level
      @username       = opts[:username]       || Settings.session.username
      @password       = opts[:password]       || Settings.session.password
      @auth_cookie    = opts[:auth_cookie]    || nil
    end
197712
public void configure(String rootUrl, Settings settings) {
    Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl);
    if (data == null) {
      data = new Data<Read, ReadGroupSet, Reference>(settings, null);
      dataSources.put(rootUrl, data);
    } else {
      data.settings = settings;
    }
  }
331276
protected function configure()
    {
        $this
            ->setDescription('Make a query')
            ->addArgument(
                'app-name',
                InputArgument::REQUIRED,
                'App name'
            )
            ->addArgument(
                'index-name',
                InputArgument::REQUIRED,
                'Index name'
            )
            ->addArgument(
                'query',
                InputArgument::OPTIONAL,
                'Query text',
                ''
            )
            ->addOption(
                'page',
                null,
                InputOption::VALUE_OPTIONAL,
                'Page',
                ModelQuery::DEFAULT_PAGE
            )
            ->addOption(
                'size',
                null,
                InputOption::VALUE_OPTIONAL,
                'Number of results',
                ModelQuery::DEFAULT_SIZE
            )
            ->addOption(
                'parameter',
                null,
                InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
                'Query parameters',
                []
            );
    }
533670
public function configureSettings()
    {
        // If no settings && sections, return.
        $settings = $this->repository()->getSettings();
        $sections = $this->repository()->getSections();

        if ($settings->isEmpty() && $sections->isEmpty()) {
            return;
        }

        // Configure sections.
        $sections->each(function ($section) {
            /** @var SectionInterface $section */
            add_settings_section($section->getId(), $section->getTitle(), [$this, 'renderSections'], $this->getSlug());
        });

        // Configure settings.
        foreach ($settings->all() as $slug => $fields) {
            foreach ($fields as $setting) {
                $setting = $this->prepareSetting($setting);

                // Display the setting.
                add_settings_field(
                    $setting->getName(),
                    $setting->getOption('label'),
                    [$this, 'renderSettings'],
                    $this->getSlug(),
                    $slug,
                    $setting
                );

                // Validate setting.
                $showInRest = $this->isShownInRest();

                if ($setting->getOption('show_in_rest', false)) {
                    $showInRest = true;
                }

                register_setting($this->getSlug(), $setting->getName(), [
                    'sanitize_callback' => [$this, 'sanitizeSetting'],
                    'default' => $setting->getOption('data', ''),
                    'show_in_rest' => $showInRest,
                    'type' => $setting->getOption('data_type', 'string')
                ]);
            }
        }
    }