Skip to content

Instantly share code, notes, and snippets.

@navt
Created December 8, 2019 19:45
Show Gist options
  • Save navt/4126d74c47219024b7270088293503cf to your computer and use it in GitHub Desktop.
Save navt/4126d74c47219024b7270088293503cf to your computer and use it in GitHub Desktop.
fieldFile в пользовательском виджете
// /templates/default/widgets/chack/chack.php
<?php
echo $file;
echo $qwe;
?>
// system/widgets/chack/options.form.php
<?php
class formWidgetChackOptions extends cmsForm {
public function init() {
$a = [
'type' => 'fieldset',
'title' => LANG_OPTIONS,
'childs' => [
new fieldFile("options:file", [
'title' => "Файл .txt",
'options' => ['extensions' => 'txt']
])
]
];
return [$a];
}
}
?>
// system/widgets/chack/widget.php
<?php
class widgetChack extends cmsWidget {
public function run(){
$file = $this->getOption("file");
if ($file === null) {
$file = "тут null";
}
return ["file" => $file,
"qwe" => "qweqwe"
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment