mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #4446 from spekulatius/codestyle
remove tailing spaces in view related classes
This commit is contained in:
commit
c170f90d5e
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface that is implemented by any classes that want to expose a method that can be called in any
|
||||
* Interface that is implemented by any classes that want to expose a method that can be called in any
|
||||
* scope in a template.
|
||||
*
|
||||
* Director::AbsoluteBaseURL is an example of this.
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Interface that is implemented by any classes that want to expose a method that can be called in any
|
||||
* Interface that is implemented by any classes that want to expose a method that can be called in any
|
||||
* scope in a template that returns values dependant on the state of the iterator of the current scope.
|
||||
*
|
||||
* SSViewer_BasicIteratorSupport is an example of this. See also @TemplateGlobalProvider
|
||||
|
@ -10,7 +10,7 @@
|
||||
* @subpackage view
|
||||
*/
|
||||
class ViewableData extends Object implements IteratorAggregate {
|
||||
|
||||
|
||||
/**
|
||||
* An array of objects to cast certain fields to. This is set up as an array in the format:
|
||||
*
|
||||
@ -26,7 +26,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
private static $casting = array(
|
||||
'CSSClasses' => 'Varchar'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* The default object to cast scalar fields to if casting information is not specified, and casting to an object
|
||||
* is required.
|
||||
@ -35,12 +35,12 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @config
|
||||
*/
|
||||
private static $default_cast = 'Text';
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private static $casting_cache = array();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -49,19 +49,19 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @var ViewableData
|
||||
*/
|
||||
protected $failover;
|
||||
|
||||
|
||||
/**
|
||||
* @var ViewableData
|
||||
*/
|
||||
protected $customisedObject;
|
||||
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $objCache = array();
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Converts a field spec into an object creator. For example: "Int" becomes "new Int($fieldName);" and "Varchar(50)"
|
||||
* becomes "new Varchar($fieldName, 50);".
|
||||
@ -72,7 +72,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public static function castingObjectCreator($fieldSchema) {
|
||||
Deprecation::notice('2.5', 'Use Object::create_from_string() instead');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a field schema (e.g. "Varchar(50)") into a casting object creator array that contains both a className
|
||||
* and castingHelper constructor code. See {@link castingObjectCreator} for more information about the constructor.
|
||||
@ -83,9 +83,9 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public static function castingObjectCreatorPair($fieldSchema) {
|
||||
Deprecation::notice('2.5', 'Use Object::create_from_string() instead');
|
||||
}
|
||||
|
||||
|
||||
// FIELD GETTERS & SETTERS -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Check if a field exists on this object or its failover.
|
||||
*
|
||||
@ -95,7 +95,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function __isset($property) {
|
||||
return $this->hasField($property) || ($this->failover && $this->failover->hasField($property));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a property/field on this object. This will check if a method called get{$property} exists, then
|
||||
* check if a field is available using {@link ViewableData::getField()}, then fall back on a failover object.
|
||||
@ -112,7 +112,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
return $this->failover->$property;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a property/field on this object. This will check for the existence of a method called set{$property}, then
|
||||
* use the {@link ViewableData::setField()} method.
|
||||
@ -127,7 +127,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
$this->setField($property, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a field exists on this object. This should be overloaded in child classes.
|
||||
*
|
||||
@ -137,7 +137,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function hasField($field) {
|
||||
return property_exists($this, $field);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a field on this object. This should be overloaded in child classes.
|
||||
*
|
||||
@ -147,7 +147,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function getField($field) {
|
||||
return $this->$field;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a field on this object. This should be overloaded in child classes.
|
||||
*
|
||||
@ -157,9 +157,9 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function setField($field, $value) {
|
||||
$this->$field = $value;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an
|
||||
* underscore into a {@link ViewableData::cachedCall()}.
|
||||
@ -168,12 +168,12 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
if($this->failover) {
|
||||
if(is_object($this->failover)) $this->addMethodsFrom('failover');
|
||||
else user_error("ViewableData::\$failover set to a non-object", E_USER_WARNING);
|
||||
|
||||
|
||||
if(isset($_REQUEST['debugfailover'])) {
|
||||
Debug::message("$this->class created with a failover class of {$this->failover->class}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($this->allMethodNames() as $method) {
|
||||
if($method[0] == '_' && $method[1] != '_') {
|
||||
$this->createMethod(
|
||||
@ -181,10 +181,10 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parent::defineMethods();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance
|
||||
* with references to both this and the new custom data.
|
||||
@ -198,16 +198,16 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
if(is_array($data) && (empty($data) || ArrayLib::is_associative($data))) {
|
||||
$data = new ArrayData($data);
|
||||
}
|
||||
|
||||
|
||||
if($data instanceof ViewableData) {
|
||||
return new ViewableData_Customised($this, $data);
|
||||
}
|
||||
|
||||
|
||||
throw new InvalidArgumentException (
|
||||
'ViewableData->customise(): $data must be an associative array or a ViewableData instance'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ViewableData
|
||||
*/
|
||||
@ -221,9 +221,9 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function setCustomisedObj(ViewableData $object) {
|
||||
$this->customisedObject = $object;
|
||||
}
|
||||
|
||||
|
||||
// CASTING ---------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Get the class a field on this object would be casted to, as well as the casting helper for casting a field to
|
||||
* an object (see {@link ViewableData::castingHelper()} for information on casting helpers).
|
||||
@ -257,7 +257,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
|
||||
if($this->failover) return $this->failover->castingHelper($field);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the class name a field on this object will be casted to
|
||||
*
|
||||
@ -267,12 +267,12 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function castingClass($field) {
|
||||
$spec = $this->castingHelper($field);
|
||||
if(!$spec) return null;
|
||||
|
||||
|
||||
$bPos = strpos($spec,'(');
|
||||
if($bPos === false) return $spec;
|
||||
else return substr($spec, 0, $bPos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the string-format type for the given field.
|
||||
*
|
||||
@ -293,29 +293,29 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function buildCastingCache(&$cache) {
|
||||
$ancestry = array_reverse(ClassInfo::ancestry($this->class));
|
||||
$merge = true;
|
||||
|
||||
|
||||
foreach($ancestry as $class) {
|
||||
if(!isset(self::$casting_cache[$class]) && $merge) {
|
||||
$mergeFields = is_subclass_of($class, 'DataObject') ? array('db', 'casting') : array('casting');
|
||||
|
||||
|
||||
if($mergeFields) foreach($mergeFields as $field) {
|
||||
$casting = Config::inst()->get($class, $field, Config::UNINHERITED);
|
||||
if($casting) foreach($casting as $field => $cast) {
|
||||
if(!isset($cache[$field])) $cache[$field] = self::castingObjectCreatorPair($cast);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($class == 'ViewableData') $merge = false;
|
||||
} elseif($merge) {
|
||||
$cache = ($cache) ? array_merge(self::$casting_cache[$class], $cache) : self::$casting_cache[$class];
|
||||
}
|
||||
|
||||
|
||||
if($class == 'ViewableData') break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TEMPLATE ACCESS LAYER -------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Render this object into the template, and get the result as a string. You can pass one of the following as the
|
||||
* $template parameter:
|
||||
@ -331,16 +331,16 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
if(!is_object($template)) {
|
||||
$template = new SSViewer($template);
|
||||
}
|
||||
|
||||
|
||||
$data = ($this->customisedObject) ? $this->customisedObject : $this;
|
||||
|
||||
|
||||
if($customFields instanceof ViewableData) {
|
||||
$data = $data->customise($customFields);
|
||||
}
|
||||
if($template instanceof SSViewer) {
|
||||
return $template->process($data, is_array($customFields) ? $customFields : null);
|
||||
}
|
||||
|
||||
|
||||
throw new UnexpectedValueException (
|
||||
"ViewableData::renderWith(): unexpected $template->class object, expected an SSViewer instance"
|
||||
);
|
||||
@ -377,7 +377,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
protected function objCacheSet($key, $value) {
|
||||
$this->objCache[$key] = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a field on this object, automatically inserting the value into any available casting objects
|
||||
* that have been specified.
|
||||
@ -397,37 +397,37 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
// HACK: Don't call the deprecated FormField::Name() method
|
||||
$methodIsAllowed = true;
|
||||
if($this instanceof FormField && $fieldName == 'Name') $methodIsAllowed = false;
|
||||
|
||||
|
||||
if($methodIsAllowed && $this->hasMethod($fieldName)) {
|
||||
$value = $arguments ? call_user_func_array(array($this, $fieldName), $arguments) : $this->$fieldName();
|
||||
} else {
|
||||
$value = $this->$fieldName;
|
||||
}
|
||||
|
||||
|
||||
if(!is_object($value) && ($this->castingClass($fieldName) || $forceReturnedObject)) {
|
||||
if(!$castConstructor = $this->castingHelper($fieldName)) {
|
||||
$castConstructor = $this->config()->default_cast;
|
||||
}
|
||||
|
||||
|
||||
$valueObject = Object::create_from_string($castConstructor, $fieldName);
|
||||
$valueObject->setValue($value, $this);
|
||||
|
||||
|
||||
$value = $valueObject;
|
||||
}
|
||||
|
||||
|
||||
if($cache) $this->objCacheSet($cacheName, $value);
|
||||
}
|
||||
|
||||
|
||||
if(!is_object($value) && $forceReturnedObject) {
|
||||
$default = $this->config()->default_cast;
|
||||
$castedValue = new $default($fieldName);
|
||||
$castedValue->setValue($value);
|
||||
$value = $castedValue;
|
||||
}
|
||||
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A simple wrapper around {@link ViewableData::obj()} that automatically caches the result so it can be used again
|
||||
* without re-running the method.
|
||||
@ -439,7 +439,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function cachedCall($field, $arguments = null, $identifier = null) {
|
||||
return $this->obj($field, $arguments, false, true, $identifier);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a given method/field has a valid value. If the result is an object, this will return the result of the
|
||||
* exists method, otherwise will check if the result is not just an empty paragraph tag.
|
||||
@ -451,7 +451,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
*/
|
||||
public function hasValue($field, $arguments = null, $cache = true) {
|
||||
$result = $cache ? $this->cachedCall($field, $arguments) : $this->obj($field, $arguments, false, false);
|
||||
|
||||
|
||||
if(is_object($result) && $result instanceof Object) {
|
||||
return $result->exists();
|
||||
} else {
|
||||
@ -459,14 +459,14 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
return ($result && $result !== '<p></p>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**#@+
|
||||
* @param string $field
|
||||
* @param array $arguments
|
||||
* @param bool $cache
|
||||
* @return string
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Get the string value of a field on this object that has been suitable escaped to be inserted directly into a
|
||||
* template.
|
||||
@ -475,37 +475,37 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
$result = $this->obj($field, $arguments, false, $cache);
|
||||
return (is_object($result) && $result instanceof Object) ? $result->forTemplate() : $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of the field without any escaping being applied.
|
||||
*/
|
||||
public function RAW_val($field, $arguments = null, $cache = true) {
|
||||
return Convert::xml2raw($this->XML_val($field, $arguments, $cache));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a field in an SQL-safe format.
|
||||
*/
|
||||
public function SQL_val($field, $arguments = null, $cache = true) {
|
||||
return Convert::raw2sql($this->RAW_val($field, $arguments, $cache));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a field in a JavaScript-save format.
|
||||
*/
|
||||
public function JS_val($field, $arguments = null, $cache = true) {
|
||||
return Convert::raw2js($this->RAW_val($field, $arguments, $cache));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the value of a field escaped suitable to be inserted into an XML node attribute.
|
||||
*/
|
||||
public function ATT_val($field, $arguments = null, $cache = true) {
|
||||
return Convert::raw2att($this->RAW_val($field, $arguments, $cache));
|
||||
}
|
||||
|
||||
|
||||
/**#@-*/
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of XML-escaped values by field name
|
||||
*
|
||||
@ -514,16 +514,16 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
*/
|
||||
public function getXMLValues($fields) {
|
||||
$result = array();
|
||||
|
||||
|
||||
foreach($fields as $field) {
|
||||
$result[$field] = $this->XML_val($field);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
// ITERATOR SUPPORT ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Return a single-item iterator so you can iterate over the fields of a single record.
|
||||
*
|
||||
@ -535,9 +535,9 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function getIterator() {
|
||||
return new ArrayIterator(array($this));
|
||||
}
|
||||
|
||||
|
||||
// UTILITY METHODS -------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need
|
||||
* access to itself.
|
||||
@ -547,7 +547,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function Me() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the directory if the current active theme (relative to the site root).
|
||||
*
|
||||
@ -562,15 +562,15 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
*/
|
||||
public function ThemeDir($subtheme = false) {
|
||||
if(
|
||||
Config::inst()->get('SSViewer', 'theme_enabled')
|
||||
Config::inst()->get('SSViewer', 'theme_enabled')
|
||||
&& $theme = Config::inst()->get('SSViewer', 'theme')
|
||||
) {
|
||||
return THEMES_DIR . "/$theme" . ($subtheme ? "_$subtheme" : null);
|
||||
}
|
||||
|
||||
|
||||
return project();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get part of the current classes ancestry to be used as a CSS class.
|
||||
*
|
||||
@ -585,17 +585,17 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
$classes = array();
|
||||
$classAncestry = array_reverse(ClassInfo::ancestry($this->class));
|
||||
$stopClasses = ClassInfo::ancestry($stopAtClass);
|
||||
|
||||
|
||||
foreach($classAncestry as $class) {
|
||||
if(in_array($class, $stopClasses)) break;
|
||||
$classes[] = $class;
|
||||
}
|
||||
|
||||
|
||||
// optionally add template identifier
|
||||
if(isset($this->template) && !in_array($this->template, $classes)) {
|
||||
$classes[] = $this->template;
|
||||
}
|
||||
|
||||
|
||||
return Convert::raw2att(implode(' ', $classes));
|
||||
}
|
||||
|
||||
@ -607,7 +607,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
public function Debug() {
|
||||
return new ViewableData_Debugger($this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -615,12 +615,12 @@ class ViewableData extends Object implements IteratorAggregate {
|
||||
* @subpackage view
|
||||
*/
|
||||
class ViewableData_Customised extends ViewableData {
|
||||
|
||||
|
||||
/**
|
||||
* @var ViewableData
|
||||
*/
|
||||
protected $original, $customised;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a new customised ViewableData object
|
||||
*
|
||||
@ -630,54 +630,54 @@ class ViewableData_Customised extends ViewableData {
|
||||
public function __construct(ViewableData $originalObject, ViewableData $customisedObject) {
|
||||
$this->original = $originalObject;
|
||||
$this->customised = $customisedObject;
|
||||
|
||||
|
||||
$this->original->setCustomisedObj($this);
|
||||
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function __call($method, $arguments) {
|
||||
if($this->customised->hasMethod($method)) {
|
||||
return call_user_func_array(array($this->customised, $method), $arguments);
|
||||
}
|
||||
|
||||
|
||||
return call_user_func_array(array($this->original, $method), $arguments);
|
||||
}
|
||||
|
||||
|
||||
public function __get($property) {
|
||||
if(isset($this->customised->$property)) {
|
||||
return $this->customised->$property;
|
||||
}
|
||||
|
||||
|
||||
return $this->original->$property;
|
||||
}
|
||||
|
||||
|
||||
public function __set($property, $value) {
|
||||
$this->customised->$property = $this->original->$property = $value;
|
||||
}
|
||||
|
||||
|
||||
public function hasMethod($method) {
|
||||
return $this->customised->hasMethod($method) || $this->original->hasMethod($method);
|
||||
}
|
||||
|
||||
|
||||
public function cachedCall($field, $arguments = null, $identifier = null) {
|
||||
if($this->customised->hasMethod($field) || $this->customised->hasField($field)) {
|
||||
$result = $this->customised->cachedCall($field, $arguments, $identifier);
|
||||
} else {
|
||||
$result = $this->original->cachedCall($field, $arguments, $identifier);
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function obj($fieldName, $arguments = null, $forceReturnedObject = true, $cache = false, $cacheName = null) {
|
||||
if($this->customised->hasField($fieldName) || $this->customised->hasMethod($fieldName)) {
|
||||
return $this->customised->obj($fieldName, $arguments, $forceReturnedObject, $cache, $cacheName);
|
||||
}
|
||||
|
||||
|
||||
return $this->original->obj($fieldName, $arguments, $forceReturnedObject, $cache, $cacheName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -687,12 +687,12 @@ class ViewableData_Customised extends ViewableData {
|
||||
* @subpackage view
|
||||
*/
|
||||
class ViewableData_Debugger extends ViewableData {
|
||||
|
||||
|
||||
/**
|
||||
* @var ViewableData
|
||||
*/
|
||||
protected $object;
|
||||
|
||||
|
||||
/**
|
||||
* @param ViewableData $object
|
||||
*/
|
||||
@ -720,22 +720,22 @@ class ViewableData_Debugger extends ViewableData {
|
||||
if($field) return "<b>Debugging Information for {$this->class}->{$field}</b><br/>" .
|
||||
($this->object->hasMethod($field)? "Has method '$field'<br/>" : null) .
|
||||
($this->object->hasField($field) ? "Has field '$field'<br/>" : null) ;
|
||||
|
||||
|
||||
// debugging information for the entire class
|
||||
$reflector = new ReflectionObject($this->object);
|
||||
$debug = "<b>Debugging Information: all methods available in '{$this->object->class}'</b><br/><ul>";
|
||||
|
||||
|
||||
foreach($this->object->allMethodNames() as $method) {
|
||||
// check that the method is public
|
||||
if($method[0] === strtoupper($method[0]) && $method[0] != '_') {
|
||||
if($reflector->hasMethod($method) && $method = $reflector->getMethod($method)) {
|
||||
if($method->isPublic()) {
|
||||
$debug .= "<li>\${$method->getName()}";
|
||||
|
||||
|
||||
if(count($method->getParameters())) {
|
||||
$debug .= ' <small>(' . implode(', ', $method->getParameters()) . ')</small>';
|
||||
}
|
||||
|
||||
|
||||
$debug .= '</li>';
|
||||
}
|
||||
} else {
|
||||
@ -743,24 +743,24 @@ class ViewableData_Debugger extends ViewableData {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$debug .= '</ul>';
|
||||
|
||||
|
||||
if($this->object->hasMethod('toMap')) {
|
||||
$debug .= "<b>Debugging Information: all fields available in '{$this->object->class}'</b><br/><ul>";
|
||||
|
||||
|
||||
foreach($this->object->toMap() as $field => $value) {
|
||||
$debug .= "<li>\$$field</li>";
|
||||
}
|
||||
|
||||
|
||||
$debug .= "</ul>";
|
||||
}
|
||||
|
||||
|
||||
// check for an extra attached data
|
||||
if($this->object->hasMethod('data') && $this->object->data() != $this->object) {
|
||||
$debug .= ViewableData_Debugger::create($this->object->data())->forTemplate();
|
||||
}
|
||||
|
||||
|
||||
return $debug;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user