本文整理匯總了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;
}