我想将表单字段的名称从Page [body]更改为body,可以说。以下是所见即所得编辑器的代码。
# fill = different categories within a group
# x = grouping vars
# y = value (height of bar)
xvar = rlang::sym('states') #grouping var
yvar = rlang::sym('pct_aware')
xlabel = ('state')
ylabel = ('% of respondents')
graphtitle = 'awareness by segmentation'
ylim_max = 100
withingroupvar = rlang::sym('seasons')
legendtitle = "seasons"
#define color palette
color_palette <- colorRampPalette(colors = c("steelblue", "darkblue"))(length(segorder_text));
p <- ggplot(data = graphinput, aes(x = factor(!!xvar, levels = jobboards), y = !!yvar,
fill = factor(!!withingroupvar, levels =segorder_text)))
p + geom_bar(stat = "identity",
position = position_dodge(0.9)) +
labs(x = xlabel, y = ylabel) +
ggtitle(graphtitle) +
geom_text(aes(label=round(!!yvar,0)), vjust=-0.6, color="black",
position = position_dodge(0.9), size=4) +
scale_fill_manual(name = legendtitle, values = color_palette) +
theme(text = element_text(size = 15)) + ylim(0,ylim_max)
我不想更改模型,而只是将字段提交到远程API时提交的表单字段的名称。
对于普通字段,我会<?php echo $form->field($model, 'body')->widget(
\yii\imperavi\Widget::className(),
[
'plugins' => ['fontcolor', 'video'],
'options'=>[
'minHeight'=>400,
'maxHeight'=>400,
'buttonSource'=>true,
//'imageUpload'=>Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
]
]
) ?>
答案 0 :(得分:0)
在选项中,您可以分配一个名称值
<?php echo $form->field($model, 'body',
[ 'options' => [ 'name' => 'your_name']])->widget(
\yii\imperavi\Widget::className(),
[
'plugins' => ['fontcolor', 'video'],
'options'=>[
'minHeight'=>400,
'maxHeight'=>400,
'buttonSource'=>true,
//'imageUpload'=>Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
]
]
) ?>
答案 1 :(得分:0)
谢谢你们的努力。
<?php
echo yii\imperavi\Widget::widget([
// You can either use it for model attribute
'model' => $model,
'attribute' => 'body',
// or just for input field
//'name' => 'body',
'htmlOptions'=>[
'name'=>'body',
],
// Some options, see http://imperavi.com/redactor/docs/
'options' => [
'toolbar' => false,
],
]);
?>
这也是
<?php echo $form->field($model, 'body',
[ 'options' => [ 'name' => 'body']])->widget(
\yii\imperavi\Widget::className(),
[
'plugins' => ['fontcolor', 'video'],
'htmlOptions'=>['name'=>'body'],
'options'=>[
'minHeight'=>400,
'maxHeight'=>400,
'buttonSource'=>true,
//'imageUpload'=>Yii::$app->urlManager->createUrl(['/file-storage/upload-imperavi'])
]
]);?>