mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Form->formTemplate() - allow rendering with Form subclass template
MINOR code convention formatting git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56142 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
f2bfbc652e
commit
7ec8c205f1
@ -265,7 +265,6 @@ class Form extends ViewableData {
|
|||||||
return $this->fields->dataFieldByName($name);
|
return $this->fields->dataFieldByName($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the form's action buttons - used by the templates
|
* Return the form's action buttons - used by the templates
|
||||||
*
|
*
|
||||||
@ -309,7 +308,6 @@ class Form extends ViewableData {
|
|||||||
$child = null;
|
$child = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -403,13 +401,13 @@ class Form extends ViewableData {
|
|||||||
* Returns the name of the form
|
* Returns the name of the form
|
||||||
*/
|
*/
|
||||||
function FormName() {
|
function FormName() {
|
||||||
return $this->class . '_' . str_replace('.','',$this->name);
|
return $this->class . '_' . str_replace('.', '', $this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function Name(){
|
function Name() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,14 +690,19 @@ class Form extends ViewableData {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a rendered version of this form.
|
* Return a rendered version of this form.
|
||||||
|
*
|
||||||
|
* This also allows for subclasses of Form to have their own template,
|
||||||
|
* falling back to 'Form' if it doesn't exist.
|
||||||
|
*
|
||||||
* This is returned when you access a form as $FormObject rather than <% control FormObject %>
|
* This is returned when you access a form as $FormObject rather than <% control FormObject %>
|
||||||
*/
|
*/
|
||||||
function forTemplate() {
|
function forTemplate() {
|
||||||
$form = $this->renderWith("Form");
|
return $this->renderWith(array(
|
||||||
return $form;
|
$this->class,
|
||||||
|
'Form'
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user