Author: fabien
Date: 2010-03-29 11:53:43 +0200 (Mon, 29 Mar 2010)
New Revision: 28849
Modified:
branches/1.3/lib/helper/FormHelper.php
branches/1.3/lib/helper/UrlHelper.php
Log:
[1.3] moved form_tag from FormHelper to UrlHelper to be consisten with symfony
1.4 (there is no consequence as the UrlHelper is always loaded, closes #7910)
Modified: branches/1.3/lib/helper/FormHelper.php
===================================================================
--- branches/1.3/lib/helper/FormHelper.php 2010-03-29 09:37:05 UTC (rev
28848)
+++ branches/1.3/lib/helper/FormHelper.php 2010-03-29 09:53:43 UTC (rev
28849)
@@ -99,50 +99,6 @@
}
/**
- * Returns an HTML <form> tag that points to a valid action, route or URL as
defined by <i>$url_for_options</i>.
- *
- * By default, the form tag is generated in POST format, but can easily be
configured along with any additional
- * HTML parameters via the optional <i>$options</i> parameter. If you are
using file uploads, be sure to set the
- * <i>multipart</i> option to true.
- *
- * <b>Options:</b>
- * - multipart - When set to true, enctype is set to "multipart/form-data".
- *
- * <b>Examples:</b>
- * <code><?php echo form_tag('@myroute'); ?></code>
- * <code><?php echo form_tag('/module/action', array('name' => 'myformname',
'multipart' => true)); ?></code>
- *
- * @param string $url_for_options valid action, route or URL
- * @param array $options optional HTML parameters for the <form> tag
- *
- * @return string opening HTML <form> tag with options
- */
-function form_tag($url_for_options = '', $options = array())
-{
- $options = _parse_attributes($options);
-
- $html_options = $options;
-
- $html_options['method'] = isset($html_options['method']) ?
strtolower($html_options['method']) : 'post';
-
- if (_get_option($html_options, 'multipart'))
- {
- $html_options['enctype'] = 'multipart/form-data';
- }
-
- $html_options['action'] = url_for($url_for_options);
-
- $html = '';
- if (!in_array($html_options['method'], array('get', 'post')))
- {
- $html = tag('input', array('type' => 'hidden', 'name' => 'sf_method',
'value' => $html_options['method']));
- $html_options['method'] = 'post';
- }
-
- return tag('form', $html_options, true).$html;
-}
-
-/**
* Returns a <select> tag, optionally comprised of <option> tags.
*
* The select tag does not generate <option> tags by default.
Modified: branches/1.3/lib/helper/UrlHelper.php
===================================================================
--- branches/1.3/lib/helper/UrlHelper.php 2010-03-29 09:37:05 UTC (rev
28848)
+++ branches/1.3/lib/helper/UrlHelper.php 2010-03-29 09:53:43 UTC (rev
28849)
@@ -404,6 +404,50 @@
}
/**
+ * Returns an HTML <form> tag that points to a valid action, route or URL as
defined by <i>$url_for_options</i>.
+ *
+ * By default, the form tag is generated in POST format, but can easily be
configured along with any additional
+ * HTML parameters via the optional <i>$options</i> parameter. If you are
using file uploads, be sure to set the
+ * <i>multipart</i> option to true.
+ *
+ * <b>Options:</b>
+ * - multipart - When set to true, enctype is set to "multipart/form-data".
+ *
+ * <b>Examples:</b>
+ * <code><?php echo form_tag('@myroute'); ?></code>
+ * <code><?php echo form_tag('/module/action', array('name' => 'myformname',
'multipart' => true)); ?></code>
+ *
+ * @param string $url_for_options valid action, route or URL
+ * @param array $options optional HTML parameters for the <form> tag
+ *
+ * @return string opening HTML <form> tag with options
+ */
+function form_tag($url_for_options = '', $options = array())
+{
+ $options = _parse_attributes($options);
+
+ $html_options = $options;
+
+ $html_options['method'] = isset($html_options['method']) ?
strtolower($html_options['method']) : 'post';
+
+ if (_get_option($html_options, 'multipart'))
+ {
+ $html_options['enctype'] = 'multipart/form-data';
+ }
+
+ $html_options['action'] = url_for($url_for_options);
+
+ $html = '';
+ if (!in_array($html_options['method'], array('get', 'post')))
+ {
+ $html = tag('input', array('type' => 'hidden', 'name' => 'sf_method',
'value' => $html_options['method']));
+ $html_options['method'] = 'post';
+ }
+
+ return tag('form', $html_options, true).$html;
+}
+
+/**
* Creates a <a> link tag to the given email (with href="mailto:...").
* If null is passed as a name, the email itself will become the name.
*
--
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.