Author: Jonathan.Wage
Date: 2010-02-02 21:45:55 +0100 (Tue, 02 Feb 2010)
New Revision: 27446
Modified:
plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalEditorPlugin/lib/helper/SympalContentSlotEditorHelper.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPagesPlugin/modules/sympal_page/templates/_view.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/slot/sfSympalContentSlotRenderer.class.php
Log:
[1.4][sfSympalPlugin][1.0] Adding options array to slots for default_value
feature and future configurability of slots
Modified: plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
===================================================================
--- plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
2010-02-02 20:33:52 UTC (rev 27445)
+++ plugins/sfSympalPlugin/trunk/lib/helper/SympalContentSlotHelper.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -30,9 +30,10 @@
* @param string $name The name of the slot
* @param string $type The type of slot
* @param string $renderFunction The function/callable used to render the
value of slots which are columns
+ * @param array $options Array of options for this slot
* @return void
*/
-function get_sympal_content_slot($content, $name, $type = 'Text',
$renderFunction = null)
+function get_sympal_content_slot($content, $name, $type = 'Text',
$renderFunction = null, $options = array())
{
$slot = null;
if ($name instanceof sfSympalContentSlot)
@@ -40,7 +41,7 @@
$slot = $name;
$name = $name->getName();
} else {
- $slot = $content->getOrCreateSlot($name, $type, $renderFunction);
+ $slot = $content->getOrCreateSlot($name, $type, $renderFunction, $options);
}
$slot->setContentRenderedFor($content);
@@ -49,7 +50,7 @@
{
use_helper('SympalContentSlotEditor');
- return get_sympal_content_slot_editor($content, $slot);
+ return get_sympal_content_slot_editor($content, $slot, $options);
} else {
return $slot->render();
}
Modified:
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
2010-02-02 20:33:52 UTC (rev 27445)
+++
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContent.class.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -159,7 +159,7 @@
return $contentSlotRef;
}
- public function getOrCreateSlot($name, $type = null, $renderFunction = null)
+ public function getOrCreateSlot($name, $type = null, $renderFunction = null,
$options = array())
{
if (!$hasSlot = $this->hasSlot($name))
{
@@ -177,6 +177,10 @@
$slot->render_function = $renderFunction;
$slot->name = $name;
$slot->type = $type;
+ if (isset($options['default_value']))
+ {
+ $slot->value = $options['default_value'];
+ }
$slot->save();
$this->addSlot($slot);
Modified:
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
2010-02-02 20:33:52 UTC (rev 27445)
+++
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentSlot.class.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -158,7 +158,7 @@
if (sfSympalContext::getInstance()->shouldLoadFrontendEditor() && !$value)
{
- $rawValue = '[Double click to enable inline edit mode.]';
+ $rawValue = __($this->getDefaultValue());
}
else
{
@@ -168,6 +168,11 @@
return $rawValue;
}
+ public function getDefaultValue()
+ {
+ return '[Double click to enable inline edit mode.]';
+ }
+
public function hasValue()
{
return trim(strip_tags($this->render()));
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalEditorPlugin/lib/helper/SympalContentSlotEditorHelper.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalEditorPlugin/lib/helper/SympalContentSlotEditorHelper.php
2010-02-02 20:33:52 UTC (rev 27445)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalEditorPlugin/lib/helper/SympalContentSlotEditorHelper.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -1,6 +1,6 @@
<?php
-function get_sympal_content_slot_editor(sfSympalContent $content,
sfSympalContentSlot $slot)
+function get_sympal_content_slot_editor(sfSympalContent $content,
sfSympalContentSlot $slot, $options = array())
{
$content->setEditableSlotsExistOnPage(true);
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPagesPlugin/modules/sympal_page/templates/_view.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPagesPlugin/modules/sympal_page/templates/_view.php
2010-02-02 20:33:52 UTC (rev 27445)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalPagesPlugin/modules/sympal_page/templates/_view.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -1,7 +1,5 @@
<?php echo get_sympal_breadcrumbs($menuItem, $content) ?>
-<?php $record = $content->getRecord() ?>
-
<h1><?php echo get_sympal_content_slot($content, 'title') ?></h1>
<?php echo get_sympal_content_slot($content, 'body', 'Markdown') ?>
\ No newline at end of file
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/slot/sfSympalContentSlotRenderer.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/slot/sfSympalContentSlotRenderer.class.php
2010-02-02 20:33:52 UTC (rev 27445)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalRenderingPlugin/lib/slot/sfSympalContentSlotRenderer.class.php
2010-02-02 20:45:55 UTC (rev 27446)
@@ -15,8 +15,6 @@
{
$value = $this->getRenderedValue();
- $this->translateInlineEditMessage($value);
-
return $value;
}
@@ -24,8 +22,6 @@
{
$value = $this->_contentSlot->getRawValue();
- $this->translateInlineEditMessage($value);
-
return $value;
}
@@ -66,12 +62,4 @@
return sfSympalToolkit::renderException($e);
}
}
-
- protected function translateInlineEditMessage(&$value)
- {
- if ('[Double click to enable inline edit mode.]' == $value)
- {
- $value = __($value);
- }
- }
}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.