事件选择

@param            $field
@param            $title
@param string|int $value
@return TimePicker
518654
public static function time($field, $title, $value = '')
    {
        return self::timePicker($field, $title, (string)$value);
    }
1350680
public static function treeChecked($field, $title, $value = [])
    {
        return self::tree($field, $title, $value)->showCheckbox(true);
    }
1243188
public function set_title($value) {
        $this->title = clean_text($value);
        $this->dirty = true;

        return $this;
    }
883177
public function select($field, $value = null)
    {
        $element = $this->resolver->resolveForSelection($field);

        $options = $element->findElements(WebDriverBy::cssSelector('option:not([disabled])'));

        if (is_null($value)) {
            $options[array_rand($options)]->click();
        } else {
            foreach ($options as $option) {
                if ((string) $option->getAttribute('value') === (string) $value) {
                    $option->click();

                    break;
                }
            }
        }

        return $this;
    }
766756
public function handleField(FieldValue $value, Closure $next): FieldValue
    {
        $eventBaseName = $this->directiveArgValue('dispatch')
            /*
             * @deprecated The aliases for dispatch will be removed in v4
             */
            ?? $this->directiveArgValue('fire')
            ?? $this->directiveArgValue('class');
        $eventClassName = $this->namespaceClassName($eventBaseName);
        $previousResolver = $value->getResolver();

        return $next(
            $value->setResolver(
                function () use ($previousResolver, $eventClassName) {
                    $result = call_user_func_array($previousResolver, func_get_args());

                    $this->eventsDispatcher->dispatch(
                        new $eventClassName($result)
                    );

                    return $result;
                }
            )
        );
    }
405198
public function setTitle(?string $value) : Contact
    {

        if ($this->data['title'] !== $value) {
            $this->data['title'] = $value;
            $this->setModified('title');
        }

        return $this;
    }
1314088
protected static function generateWithTooltip($value, $title, array $attributes = [])
    {
        $attributes['data-toggle']         = 'tooltip';
        $attributes['data-original-title'] = $title;

        return static::generate($value, $attributes);
    }
1155318
public static function select($field, $title, $value = '')
    {
        $multiple = is_array($value) ? true : false;
        $select = new Select($field, $title, $value);
        $select->multiple($multiple);
        return $select;
    }
1358671
static public function option($value='', $title, $selected_value=null, $depth=0, $fields=array('id', 'title', 'depth'))
    {
        $selected_values = (array) $selected_value;
        $selected_values = array_map(function ($v) {
            return $v . '$';    // suffix, trans 0 == '' to '0$' == '$'
        }, $selected_values);
        $str = '';
        if (is_scalar($title)) {// 如果值是字串，当作 $name=$value 处理
            $str .= '<option value="' . $value . '"';
            if (in_array($value . '$', $selected_values)) $str .= ' selected="selected"';
            $str   .= '>';
            if ($depth) {
                $str .= str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth) . '|-';
            }
            $str .= $title . '</option>' . PHP_EOL;
        } elseif(is_array($title) && isset($title[$fields[0]])) {    // 如果是数组，当作 ['title'=>$title, 'value'=>$value, ...] 处理
            $str    = '<option value="' . $title[$fields[0]] . '"';
            if (in_array($title[$fields[0]] . '$', $selected_values)) {
                $str .= ' selected="selected"';
            }
            $str   .= '>';
            $depth = isset($fields[2]) && isset($title[$fields[2]]) ? $title[$fields[2]] : $depth;
            if ($depth) {
                $str .= str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $depth) . '|-';
            }
            if (strpos($fields[1], '|') !== false) {
                $tfields = array_map(function ($v) { return trim($v); }, explode('|', $fields[1]));
                $show_text = isset($title[$tfields[0]]) ? $title[$tfields[0]] : $title[$fields[0]];
                if (isset($title[$tfields[1]])) {
                    $show_text .= '(' . $title[$tfields[1]] . ')';
                }
            } else {
                $show_text = isset($title[$fields[1]]) ? $title[$fields[1]] : $title[$fields[0]];
            }
            $str .= $show_text . '</option>' . PHP_EOL;
    
            // 如果有子级进行递归调用
            if (isset($title['items']) && is_array($title['items'])) {
                foreach ($title['items'] as $k => $v) {
                    $str .= static::option($k, $v, $selected_value, $depth+1, $fields);
                }
            }
        }
        
        return $str;
    }
250861
private function selectValue(DocumentElement $page, $field, $value, $time=5)
	{
		$this->waitForLoadingResults($time);
		
		$chosenResults = $page->findAll('css', '.select2-results li');
		foreach ($chosenResults as $result) {
			$text = $result->getText();
			if (false!==strpos($text,$value)) {
				$result->click();
				return;
			}
		}
		
		throw new \Exception(sprintf('Value "%s" not found for "%s"', $value, $field));
	}
131995
protected static function sendDumpInAjaxHeader ($value, $title, $options) {
		static $ajaxHeadersIndex = 0;
		$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
		$response = & $app->GetResponse();
		list ($dumpStr,) = self::formatDebugDump(
			[$value, $title, $options],
			$app->GetRequest()->GetAppRoot()
		);
		$dumpStr64Arr = str_split(base64_encode($dumpStr), 5000);
		foreach ($dumpStr64Arr as $key => $base64Item) 
			$response->SetHeader(
				'X-MvcCore-Debug-' . $ajaxHeadersIndex . '-' . $key, 
				$base64Item
			);
		$ajaxHeadersIndex += 1;
		$response->SetHeader('X-MvcCore-Debug', $ajaxHeadersIndex);
	}
1100894
public static function timeRange($field, $title, $startTime = '', $endTime = '')
    {
        return self::timePicker($field, $title, [(string)$startTime, (string)$endTime], TimePicker::TYPE_TIME_RANGE);
    }
694606
public static function year($field, $title, $value = '')
    {
        return self::datePicker($field, $title, (string)$value, DatePicker::TYPE_YEAR);
    }
1100411
public function setResult($field, $value)
    {
        if (!isset($this->results[$field])) {
            $this->results[$field] = $value;
        }

        return $this;
    }
976953
public function log($value, $title = '')
    {
        if (!is_null($this->getLogger())) {
            $this->getLogger()->setTitle($title);
            $this->getLogger()->log($value);
        }
    }
1124270
public function getFormField($name = null, $title = null, $value = null)
    {
        return SimpleSpamGuardField::create($name, $title, $value)->setTimeLimit($this->timeLimit);
    }
275391
public static function tree($field, $title, $value = [], $type = Tree::TYPE_CHECKED)
    {
        return (new Tree($field, $title, $value))->type($type);
    }