Permalink
Browse files

Allow Title to be translated on Form view

  • Loading branch information...
1 parent e793043 commit 898d6c89d1bbfdd4a302514b6b5977632370e1aa @sebastienheraud sebastienheraud committed Feb 14, 2017
Showing with 11 additions and 5 deletions.
  1. +1 −1 components/com_cck/views/form/tmpl/edit.xml
  2. +10 −4 components/com_cck/views/form/view.html.php
@@ -22,7 +22,7 @@
<field name="cckjs" type="cckjs" label="" description=""
js_appendto="jform_params_show_form_title=J(as tag),#jform_params_tag_form_title,J(with class),#jform_params_class_form_title"
js_isvisiblewhen="div#jform_params_cckjs-more='jform_params_show_form_title','1',false" js_format="html" hidden="true" />
- <field name="display_form_title" type="cck" construction="core_dev_select" cck_options="Menu Item=0||Custom=1" cck_selectlabel="Inherited" default="" label="LIB_CCK_TITLE" description="" class="inputbox" />
+ <field name="display_form_title" type="cck" construction="core_dev_select" cck_options="Custom Text=1||Language Constant=2||Menu Item=0" cck_selectlabel="Inherited" default="" label="LIB_CCK_TITLE" description="" class="inputbox" />
<field name="title_form_title" type="cck" construction="core_dev_text" default="" label="" description="" class="inputbox" cck_attributes="placeholder='J(Title)'" js_appendto="jform_params_display_form_title=#jform_params_title_form_title" js_isvisiblewhen="div#jform_params_title_form_title-more='jform_params_display_form_title','1',false" js_format="html" hidden="true" />
<field name="show_form_desc" type="cck" construction="core_show_hide2" default="" cck_selectlabel="Use Global"
label="COM_CCK_CONFIG_SHOW_FORM_DESCRIPTION" description="COM_CCK_CONFIG_SHOW_FORM_DESCRIPTION_DESC" class="inputbox" />
@@ -105,12 +105,18 @@ protected function prepareDisplay( $preconfig )
if ( !is_object( @$options ) ) {
$options = new JRegistry;
}
- if ( $params->get( 'display_form_title', '' ) == '1' ) {
- $this->title = $params->get( 'title_form_title', '' );
+ if ( $params->get( 'display_form_title', '' ) == '2' ) {
+ $this->title = '';
+
+ if ( is_object( $type ) ) {
+ $this->title = Jtext::_( 'APP_CCK_FORM_'.$type->name.'_TITLE_'.( $this->isNew ? 'ADD' : 'EDIT' ) );
+ }
+ } elseif ( $params->get( 'display_form_title', '' ) == '1' ) {
+ $this->title = $params->get( 'title_form_title', '' );
} elseif ( $params->get( 'display_form_title', '' ) == '0' ) {
- $this->title = $menu->title;
+ $this->title = $menu->title;
} else {
- $this->title = @$type->title;
+ $this->title = ( isset( $type->title ) ) ? $type->title : '';
}
$this->show_form_title = $params->get( 'show_form_title' );
if ( $this->show_form_title == '' ) {

0 comments on commit 898d6c8

Please sign in to comment.