本文整理汇总了PHP中UploadField::name方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::name方法的具体用法?PHP UploadField::name怎么用?PHP UploadField::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _createSliceConfigUploadForm
/**
* @param $config SliceConfig
* @return Form
*/
public function _createSliceConfigUploadForm($config)
{
$form = new Form('upload');
//load up our engines.
if (User::isAdmin()) {
$engines = SliceEngine::getAllEngines()->getAll();
} else {
$engines = SliceEngine::getPublicEngines()->getAll();
}
$engs = array();
foreach ($engines as $row) {
/* @var $e SliceEngine */
$e = $row['SliceEngine'];
$engs[$e->id] = $e->getName();
}
$form->add(SelectField::name('engine_id')->label('Slice Engine')->help('Which slicing engine does this config use?')->required(true)->value($config->get('engine_id'))->options($engs));
$form->add(TextField::name('config_name')->label('Config Name')->help('What is the name of this slicing configuration.')->required(true)->value($config->get('config_name')));
if ($config->isHydrated()) {
$form->add(CheckboxField::name('expire_slicejobs')->label('Expire Old Slice Jobs')->help('If checked, old slice jobs will be expired and never re-used.')->value(1));
}
$form->add(UploadField::name('config_file')->label('Configuration File')->help('The configuration file to use (.ini for Slic3r)')->required(true));
return $form;
}
示例2: createFileForm
/**
* @return Form
*/
private function createFileForm()
{
/** @var Form $form */
$form = new Form('file', true);
/** @var StorageInterface $file */
$file = Storage::newFile();
$fields = $file->getUploadFields();
foreach ($fields as $name => $value) {
$form->add(HiddenField::name($name)->value($value));
}
$form->add(UploadField::name("file"));
$form->setSubmitText("Upload File");
$form->action = $file->getUploadURL();
return $form;
}