Created
December 8, 2019 19:45
-
-
Save navt/4126d74c47219024b7270088293503cf to your computer and use it in GitHub Desktop.
fieldFile в пользовательском виджете
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /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