Dátumformátum + dátumformátum-típus exportálása

  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • GeSHi library error: sites/all/modules/geshifilter/geshi is not a directory.
  • The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.
Category: 
Leírás

Features és a saját dátumformátumok/típusok összakalapálása már több éves issue. Nálam szinte minden projectnél előjön, a #drupal.hu irc csatornán is felmerül rendszeresen.

A feladat tehát a következő: Legyen egy kódbázisban tárolt, újrafelhasználható, tetszőleges dátumformátum-típus, amely egy dátumformátumhoz van rendelve.

No de mi ez a dátumformátum, és dátumformátum-típus?

Dátumformátum-típus: A php date függvényének a paramétere. Maga a string, amely a date() függvény kimenetét produálja, pl: M d, Y - G:i

Dátumformátum: Ez már a drupal saját vuduja. Egy típusnak három paramétere lehet:

  • type - A típus elnevezése
  • format - A dátumformátum stringje
  • locale - A nyelvek tömbje, amelyre a dátumformátumok alkalmazhatók, ha nincs megadva, akkor nyelvfüggetlen a beállítás.

Ahhoz, hogy nekünk kód alapú dátumformátumunk legyen, két hookkal kell dolgozni:

Dátumformátum
[geshifilter-drupal6] function MYMODULE_hook_date_formats() { return array( array( 'type' => 'M_d_yyyy_G_i', #ez csak a gépi név, lehet bármi, én így szeretem, hogy a kulcs némileg követi az eredményt. 'format' => 'M d, Y - G:i', 'locales' => array(), #nincs nyelvi korlátozás ), ) }[/geshifilter-drupal6]

Dátumformátum-típus

Itt fontos, hogy a kulcs megegyezzen a hook_date_formats() 'type' paraméterével. Az érték az admin/config/regional/date-time oldalon fog megjelenni, valahogy így:

[geshifilter-drupal6]function MYMODULE_hook_date_format_types() { return array( 'M_d_yyyy_G_i' => t('Example: Feb 5, 2013 - 14:09 (M d, Y - G:i)'), ); }[/geshifilter-drupal6]

Ezzel még viszont nincs vége. Ami a kettőt összekapcsolja, az egy változó, mégpedig a date_format_[type], tehát esetünkben a date_format_M_d_yyyy_G_i. Ha az adott typehoz egyetlen formatot vettünk fel, akkor csak az admin/config/regional/date-time oldalon kell nyomni egy save-t.
Ha ez kész van, mehet feature-be a változó.

Comments

Peculiar article, exactly

Peculiar article, exactly what I needed.

Hey there superb website!

Hey there superb website! Does running a blog similar to this require a
lot of work? I have absolutely no expertise in programming however I was hoping to start my own blog
soon. Anyways, if you have any suggestions or techniques for new blog owners please share.
I understand this is off subject nevertheless I simply
had to ask. Kudos!

Simply wish to say your

Simply wish to say your article is as astonishing. The clearness for your submit
is simply nice and that i can suppose you're a professional
on this subject. Well along with your permission allow me to take
hold of your RSS feed to keep updated with
forthcoming post. Thanks 1,000,000 and please carry on the gratifying work.

Hi there! This post could not

Hi there! This post could not be written any better!
Going through this post reminds me of my previous roommate!
He continually kept talking about this. I most certainly will forward this article
to him. Pretty sure he'll have a good read. Thank you for
sharing!

Ha a Date API modult

Ha a Date API modult használjuk, akkor – elvileg – külön saját modul nélkül is exportálhatunk Feature-be dátum formátumot (és típust) Strongarmon keresztül.

Elképzelhető, hogy van még valami függőség (a Date API-n kívül), mert többnyelvű oldalakon eddig ez nekem simán működött, most viszont egy egyszerű (csak) localizált oldalnál vannak gondjaim vele…

Hi Dear, are you in fact

Hi Dear, are you in fact visiting this web site on a regular basis, if so then you will absolutely take fastidious know-how.

hey there and thank you for

hey there and thank you for your info – I've certainly picked up anything new from right here.
I did however expertise a few technical issues using this web
site, as I experienced to reload the website lots of times previous to I
could get it to load correctly. I had been wondering if your web
hosting is OK? Not that I am complaining,
but sluggish loading instances times will often affect your placement in google and
could damage your high quality score if ads and marketing with
Adwords. Anyway I am adding this RSS to my email and could look out
for a lot more of your respective intriguing content.
Ensure that you update this again very soon.

With havin so much content do

With havin so much content do you ever run into
any problems of plagorism or copyright violation? My site has a lot of completely unique content I've either created myself or
outsourced but it looks like a lot of it is popping
it up all over the web without my authorization. Do you know any techniques
to help reduce content from being ripped off? I'd genuinely appreciate it.

Great post. I was checking

Great post. I was checking constantly this blog and I'm
impressed! Extremely useful information specifically the last part :) I care for such information a lot.
I was seeking this particular information for a long time.
Thank you and good luck.

Hi there! I know this is

Hi there! I know this is kinda off topic nevertheless I'd figured I'd ask.
Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa?
My blog goes over a lot of the same subjects as yours and I feel we could greatly benefit from each other.
If you might be interested feel free to send me an email.
I look forward to hearing from you! Fantastic blog by the way!

I really like your blog..

I really like your blog.. very nice colors & theme.
Did you create this website yourself or did you hire someone
to do it for you? Plz reply as I'm looking to construct my own blog and
would like to find out where u got this from. thanks

Nice post. I was checking

Nice post. I was checking continuously this weblog and
I'm inspired! Extremely helpful information specially the ultimate section :) I maintain such information much.
I was looking for this certain info for a long time.

Thank you and good luck.

Hmm.. Kb mindig használom a

Hmm.. Kb mindig használom a date modult, de ezzel eddig nem találkoztam. Mondjuk lehet, hogy csak régen próbáltam, valahogy egyszerűbb volt a copypaste. :)

Just desire to say your

Just desire to say your article is as astounding.
The clarity in your post is simply cool and i could assume you're an expert on this subject.
Well with your permission let me to grab your feed to keep updated with forthcoming post.
Thanks a million and please continue the gratifying work.

Whats up this is kind of of

Whats up this is kind of of off topic but I was wanting to
know if blogs use WYSIWYG editors or if you have to manually code with HTML.

I'm starting a blog soon but have no coding skills
so I wanted to get advice from someone with experience.
Any help would be enormously appreciated!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Internal paths in double quotes, written as "internal:node/99", for example, are replaced with the appropriate absolute URL or relative path.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <del> <img>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <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].
  • Each email address will be obfuscated in a human readable fashion or (if JavaScript is enabled) replaced with a spamproof clickable link.