Tartalombeküldési form dátumformátumának megváltoztatása

Kategória: 
Snippet

A felhasználókat meg tudja zavarni a beküldés idejéhez beírt 2010-07-08 11:49:42 +0200 dátumformátum. Így alakíthatjuk át hook_form_alterből, kösz Yorknak és a #drupal.hu csatornának a substr tippért, én magamtól először valamilyen regexpes megoldást kerestem. :)

<?php
$is_node_form = substr($form_id, -9) ;
if ($is_node_form === 'node_form') {
$node = node_load(arg(1));
if ($node->created) {
$form['author']['date']['#default_value'] = format_date($node->created, 'custom', 'Y-m-d H:i:s') ;
}
$form['author']['date']['#description'] = t
('Format: %time. Leave blank to use the time of form submission.', array('%time' => !empty($node->date) ? $node->date : format_date($node->created, 'custom', 'Y-m-d H:i:s')));
}
?>

Hozzászólások

Hozzászólás

A mező tartalma nem nyilvános.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Engedélyezett HTML elemek: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • A webcímek és email címek automatikusan linkekké alakulnak.
  • A sorokat és bekezdéseket a rendszer automatikusan felismeri.
  • Engedélyezett HTML elemek: <a> <blockquote> <br> <cite> <code> <dd> <del> <div> <dl> <dt> <em> <li> <ol> <p> <span> <strong> <ul>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <mysql>, <php>, <python>, <ruby>, <sql>. The supported tag styles are: <foo>, [foo].
  • Minden email cím át lesz alakítva ember által olvasható módon, vagy (ha a JavaScript engedélyezett) ki lesz cserélve kattintható, de biztonságos hivatkozásra.
By submitting this form, you accept the Mollom privacy policy.