Detects the form alignment when possible.

@param array $options Options.
@return string Form alignment type. One of `default`, `horizontal` or `inline`.
189648
protected function _detectFormAlignment($options)
    {
        foreach (['horizontal', 'inline'] as $align) {
            if ($this->checkClasses('form-' . $align, $options)) {
                return $align;
            }
        }

        return $this->getConfig('align');
    }
65407
protected function prepareOptions(array $options = [])
    {
        $helper = $this->formHelper;

        if (array_get($this->options, 'template') !== null) {
            $this->template = array_pull($this->options, 'template');
        }

        $options = $helper->mergeOptions($this->options, $options);

        if ($this->parent->haveErrorsEnabled()) {
            $this->addErrorClass($options);
        }

        if ($this->getOption('attr.multiple')) {
            $this->name = $this->name.'[]';
        }

        if ($this->getOption('required') === true) {
            $options['label_attr']['class'] .= ' ' . $this->formHelper
                ->getConfig('defaults.required_class', 'required');
            $options['attr']['required'] = 'required';
        }

        $options['wrapperAttrs'] = $helper->prepareAttributes($options['wrapper']);
        $options['errorAttrs'] = $helper->prepareAttributes($options['errors']);

        if ($options['is_child']) {
            $options['labelAttrs'] = $helper->prepareAttributes($options['label_attr']);
        }

        if ($options['help_block']['text']) {
            $options['help_block']['helpBlockAttrs'] = $helper->prepareAttributes(
                $options['help_block']['attr']
            );
        }

        return $options;
    }
103617
public function getIdFromOptions(array $options) : string
    {
        $optionsResolver = new OptionsResolver();
        $optionsResolver->setRequired('id');

        $options = $optionsResolver->resolve($options);

        return $options['id'];
    }
461497
public static function getOptionsValidator(array $options) {
    return function ($value) use ($options) {
      if (!in_array($value, $options)) {
        $options_formatted = implode(', ', $options);
        $error_message = sprintf('The value should be one of the following: %s.', $options_formatted);
        throw new \UnexpectedValueException($error_message);
      }
      return $value;
    };
  }
619106
public function form($options)
    {
        $options = $this->merge([], (array) $options);
        $Form    = $this->App->s::widgetForm($this, []);

        $class = ''; // Initialize.
        $class .= $this->App::CORE_CONTAINER_SLUG.'-menu-page-area';
        $class .= ' '.$this->App::CORE_CONTAINER_SLUG.'-widget-wrapper';
        $class .= ' '.$this->App->Config->©brand['©slug'].'-widget-wrapper';
        $class .= $this->id_base !== $this->App->Config->©brand['©slug'] ? ' '.$this->id_base.'-widget-wrapper' : '';

        echo '<div class="'.esc_attr($class).'">';
        echo    $Form->openTable();

        echo      $Form->inputRow([
            'label' => __('Title:', 'wp-sharks-core'),
            'name'  => 'title',
            'value' => $options['title'],
        ]);
        echo      $this->formContent($Form, $options);

        echo    $Form->closeTable();
        echo '</div>';
    }
859487
private function parseOptions(array $options)
    {
        if (isset($options['headers']) && is_array($options['headers'])) {
            $this->headers = $options['headers'];
        }

        if (isset($options['scheme']) && strtolower($options['scheme']) === 'http') {
            $this->scheme = 'http';
        }

        if (isset($options['output_format']) && strtolower($options['output_format']) === 'xml') {
            $this->outputFormat = 'xml';
        }
    }
215216
protected function createForm($options = null)
    {
        $optionVars = array('askCheck', 'askOld', 'checkFields', 'forceRules', 'labelWidthFactor', 'reportRules');
        foreach ($optionVars as $name) {
            if ($this->$name !== null) {
                $options[$name] = $this->$name;
            }
        }
        $options['useTableLayout'] = false; // Layout set by this snippet

        return $this->user->getChangePasswordForm($options);
    }
98897
static function formatOptions( $options, $default = false ) {
		$data = '';

		foreach( $options as $label => $value ){
			if( is_array( $value ) ) {
				$contents = self::formatOptions( $value, $default );
				$data .= self::tags( 'optgroup', array( 'label' => $label ), $contents ) . "\n";
			} else {
				$data .= self::option( $label, $value, $value === $default ) . "\n";
			}
		}

		return $data;
	}
940607
private function optionsAsText()
    {
        $max = $this->getMaxWidth();
        $messages = [];

        $options = $this->getOptions();
        if ($options) {
            $messages[] = '<comment>Options:</comment>';

            foreach ($options as $option) {
                if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
                    $default = \sprintf('<comment> (default: %s)</comment>', $this->formatDefaultValue($option->getDefault()));
                } else {
                    $default = '';
                }

                $multiple = $option->isArray() ? '<comment> (multiple values allowed)</comment>' : '';
                $description = \str_replace("\n", "\n" . \str_pad('', $max + 2, ' '), $option->getDescription());

                $optionMax = $max - \strlen($option->getName()) - 2;
                $messages[] = \sprintf(
                    " <info>%s</info> %-${optionMax}s%s%s%s",
                    '--' . $option->getName(),
                    $option->getShortcut() ? \sprintf('(-%s) ', $option->getShortcut()) : '',
                    $description,
                    $default,
                    $multiple
                );
            }

            $messages[] = '';
        }

        return \implode(PHP_EOL, $messages);
    }
561649
public function ueditor($options = [])
    {
        if (! isset($options['rows'])) {
            $options['rows'] = 5;
        }
        $options = array_merge($this->inputOptions, $options);
        $this->adjustLabelFor($options);
        $name = isset($options['name']) ? $options['name'] : Html::getInputName($this->model, $this->attribute);
        if (isset($options['value'])) {
            $value = $options['value'];
            unset($options['value']);
        } else {
            $value = Html::getAttributeValue($this->model, $this->attribute);
        }
        if (! array_key_exists('id', $options)) {
            $options['id'] = Html::getInputId($this->model, $this->attribute);
        }
        //self::normalizeMaxLength($model, $attribute, $options);
        $this->parts['{input}'] = Ueditor::widget(['content' => $value, 'name' => $name, 'id' => $this->attribute]);

        return $this;
    }
1125640
protected function getOptions(array $options)
    {
        $labels = [];
        if ($this->hasLanguages()) {
            // As this point we are construction the options for multiple languages
            foreach ($this->languages as $language) {
                foreach ($options as $key => $option) {
                    $labels[$language][$key] = Helpers::convertNameToLabel($option);
                }
            }
        } else {

            // At this point we are just formatting the labels
            foreach ($options as $key => $option) {
                $labels[$key] = Helpers::convertNameToLabel($option);
            }
        }

        return $labels;
    }
1068373
public function open($options = [])
    {
        $attributes = [];

        if (self::MODE_EDIT === $this->mode) {
            $this->addHiddenField((new Form\Field\Hidden('_method'))->value('PUT'));
        }

        $this->addRedirectUrlField();

        $attributes['action'] = $this->getAction();
        $attributes['method'] = array_get($options, 'method', 'post');
        $attributes['accept-charset'] = 'UTF-8';

        $attributes['class'] = array_get($options, 'class');

        if ($this->hasFile()) {
            $attributes['enctype'] = 'multipart/form-data';
        }

        $html = [];
        foreach ($attributes as $name => $value) {
            $html[] = "$name=\"$value\"";
        }

        return '<form '.implode(' ', $html).' pjax-container>';
    }
53598
public function getFormOptions($options = []) {
		if (empty($options) || !is_array($options)) {
			$options = [];
		}

		$optionsDefault = $this->_getOptionsForElem('form');
		$result = $optionsDefault + $options;

		return $result;
	}
127970
protected function getFormGroupOptions($name = null, array $options = [])
    {
        $class = 'form-group';

        if ($name) {
            $class .= ' ' . $this->getFieldErrorClass($name);
        }

        return array_merge(['class' => $class], $options);
    }
906882
public function checkbox($options)
    {

        if (is_string($options)) {
            $options = ['class' => $options];
        }

        if (!Arr::has($options, 'type')) {
            Arr::set($options, 'type', 'checkbox');
        }

        return $this->input($options);
    }
219168
protected function transferOptionsToLabels(array $options)
    {
        $finalOptions = [];
        $index = 0;

        foreach ($options as $value => $option) {

            if (!is_array($option)) {
                // At this point the options are plain text without locale
                $finalOptions[] = new Label($option, $this->localeGroup, true, $this->defaultLang, null, $value);
                continue;
            }

            $optionLang = $value;
            foreach ($option as $optionValue => $text) {
                // At this point the options are in array which mean they need translation.
                $finalOptions[] = new Label($text, $this->localeGroup, false, $optionLang, null, $optionValue);
            }
        }

        return $finalOptions;
    }
470764
protected function _initializationOptions($options = array()) {
		$defaults = array(
			'_buffer' => true,
			'_css' => true,
			'_cssText' => true,
			'_scripts' => true,
			'_scriptBlock' => false,
			'_editor' => true,
			'_inline' => true,
		);

		return json_encode(array_diff_key(array_merge(
			$defaults,
			(array)$options
		), $defaults));
	}