allow intl for image object
This commit is contained in:
@@ -98,9 +98,8 @@ class CouponController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
$this->checkAuth(AdminResources::COUPON, array(), AccessManager::VIEW);
|
||||||
|
|
||||||
// Database request repeated in the loop but cached
|
|
||||||
$search = CouponQuery::create();
|
$coupon = CouponQuery::create()->findPk($couponId);
|
||||||
$coupon = $search->findOneById($couponId);
|
|
||||||
|
|
||||||
if ($coupon === null) {
|
if ($coupon === null) {
|
||||||
return $this->pageNotFound();
|
return $this->pageNotFound();
|
||||||
|
|||||||
@@ -823,6 +823,7 @@ class FileController extends BaseAdminController
|
|||||||
protected function createImageEventInstance($parentType, $model, $data)
|
protected function createImageEventInstance($parentType, $model, $data)
|
||||||
{
|
{
|
||||||
$imageCreateEvent = new ImageCreateOrUpdateEvent($parentType, null);
|
$imageCreateEvent = new ImageCreateOrUpdateEvent($parentType, null);
|
||||||
|
$model->setLocale($data['locale']);
|
||||||
|
|
||||||
if (isset($data['title'])) {
|
if (isset($data['title'])) {
|
||||||
$model->setTitle($data['title']);
|
$model->setTitle($data['title']);
|
||||||
@@ -840,6 +841,8 @@ class FileController extends BaseAdminController
|
|||||||
$model->setPostscriptum($data['postscriptum']);
|
$model->setPostscriptum($data['postscriptum']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$imageCreateEvent->setModelImage($model);
|
$imageCreateEvent->setModelImage($model);
|
||||||
|
|
||||||
return $imageCreateEvent;
|
return $imageCreateEvent;
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ class ImageCreateOrUpdateEvent extends ActionEvent
|
|||||||
/** @var string Parent name */
|
/** @var string Parent name */
|
||||||
protected $parentName = null;
|
protected $parentName = null;
|
||||||
|
|
||||||
|
protected $locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@@ -70,6 +72,26 @@ class ImageCreateOrUpdateEvent extends ActionEvent
|
|||||||
$this->parentId = $parentId;
|
$this->parentId = $parentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $locale
|
||||||
|
*/
|
||||||
|
public function setLocale($locale)
|
||||||
|
{
|
||||||
|
$this->locale = $locale;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLocale()
|
||||||
|
{
|
||||||
|
return $this->locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Image to save
|
* Set Image to save
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -130,6 +130,12 @@ abstract class ImageModification extends BaseForm
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
->add("locale", "text", array(
|
||||||
|
"constraints" => array(
|
||||||
|
new NotBlank()
|
||||||
|
),
|
||||||
|
"label_attr" => array("for" => "locale_create")
|
||||||
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,13 @@
|
|||||||
|
|
||||||
{form name="$formId"}
|
{form name="$formId"}
|
||||||
<form method="POST" action="{url path="/admin/image/type/{$imageType}/{$ID}/update"}" {form_enctype form=$form} class="clearfix">
|
<form method="POST" action="{url path="/admin/image/type/{$imageType}/{$ID}/update"}" {form_enctype form=$form} class="clearfix">
|
||||||
|
{include
|
||||||
|
file = "includes/inner-form-toolbar.html"
|
||||||
|
hide_submit_buttons = false
|
||||||
|
|
||||||
<div class="row inner-toolbar clearfix">
|
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
||||||
<div class="col-md-6 inner-actions pull-right">
|
close_url = "{url path="{$redirectUrl}"}"
|
||||||
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
}
|
||||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
@@ -44,6 +44,10 @@
|
|||||||
<input type="hidden" name="{$name}" value="{url path="/admin/image/type/{$imageType}/{$ID}/update"}" />
|
<input type="hidden" name="{$name}" value="{url path="/admin/image/type/{$imageType}/{$ID}/update"}" />
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
|
{form_field form=$form field='locale'}
|
||||||
|
<input type="hidden" name="{$name}" value="{$edit_language_locale}" />
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||||
|
|
||||||
<p class="title title-without-tabs">{intl l="Image information"}</p>
|
<p class="title title-without-tabs">{intl l="Image information"}</p>
|
||||||
@@ -101,12 +105,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row inner-toolbar clearfix">
|
{include
|
||||||
<div class="col-md-6 inner-actions pull-right">
|
file = "includes/inner-form-toolbar.html"
|
||||||
<a href="{url path="{$redirectUrl}"}" class="btn btn-default btn-info">{intl l='Back'} <span class="glyphicon glyphicon-remove"></span></a>
|
hide_submit_buttons = false
|
||||||
<button type="submit" name="save_mode" value="stay" class="btn btn-default btn-primary" title="{intl l='Save'}">{intl l='Save'} <span class="glyphicon glyphicon-ok"></span></button>
|
hide_flags = true
|
||||||
</div>
|
|
||||||
</div>
|
page_url = "{url path="/admin/image/type/{$imageType}/{$ID}/update"}"
|
||||||
|
close_url = "{url path="{$redirectUrl}"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
{/form}
|
{/form}
|
||||||
|
|||||||
Reference in New Issue
Block a user