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.
  • 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.
  • 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

Great looking web site.

Great looking web site. Presume you did a bunch of your very own coding.

I was curious if you ever

I was curious if you ever considered changing the layout of your site?
Its very well written; I love what youve got to say. But maybe you could a little more in the
way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or 2 pictures.
Maybe you could space it out better?

mothercenter.

Have you ever considered

Have you ever considered creating an ebook or
guest authoring on other blogs? I have a blog centered on the same ideas you discuss
and would really like to have you share some stories/information. I know my subscribers
would appreciate your work. If you're even remotely interested, feel free to shoot
me an e mail.

I have been surfing online

I have been surfing online more than 3 hours today, yet I never found any interesting article like yours.
It is pretty worth enough for me. Personally, if all web owners and bloggers made good content as you did,
the internet will be much more useful than ever before.

Link exchange is nothing else

Link exchange is nothing else but it is only placing the other person's blog link on your page at appropriate place and other person will also do same in favor of you.

I’m not that much of a online

I’m not that much of a online reader to be honest but your sites really nice, keep it
up! I'll go ahead and bookmark your website to come back in the future.
All the best

Very beneficial look forth to

Very beneficial look forth to coming back.

I love what you guys are

I love what you guys are usually up too. This type of clever
work and coverage! Keep up the fantastic works guys I've incorporated you guys to my own blogroll.

I just couldn't go away your

I just couldn't go away your web site prior to suggesting that I really enjoyed the standard information a person provide to your visitors?
Is gonna be back ceaselessly in order to check out new posts

Hi, There's no doubt that

Hi, There's no doubt that your site could possibly be having internet browser compatibility issues.
Whenever I look at your site in Safari, it looks fine however,
if opening in IE, it has some overlapping issues.
I just wanted to provide you with a quick heads up!
Aside from that, fantastic website!

Hey there are using Wordpress

Hey there are using Wordpress for your blog platform?
I'm new to the blog world but I'm trying to get started and set up my own.
Do you require any html coding knowledge to make your own blog?
Any help would be really appreciated!

Feel free to visit my homepage; canadian pharmacies shipping to usa

I visited various blogs but

I visited various blogs but the audio quality for audio songs present at
this web page is really marvelous.

Truly this is a advantageous

Truly this is a advantageous websites.

I've learn a few excellent

I've learn a few excellent stuff here. Definitely
worth bookmarking for revisiting. I wonder how a lot
effort you set to create this type of wonderful informative web site.

If you want to take a good

If you want to take a good deal from this article then you have to apply such methods to your
won webpage.

Appreciate this post. Let me

Appreciate this post. Let me try it out.

Feel free to visit my webpage ... canadian pharmacies shipping to usa

Hey! Someone in my Myspace

Hey! Someone in my Myspace group shared this website with us so I came to take a look.
I'm definitely loving the information. I'm
bookmarking and will be tweeting this to my followers!
Excellent blog and brilliant style and design.

You have got among the finest

You have got among the finest web-sites.

Hi there this is somewhat of

Hi there this is somewhat 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 knowledge so I wanted to
get advice from someone with experience. Any help would be greatly appreciated!

I think the admin of this

I think the admin of this site is truly working hard for his site,
as here every data is quality based information.

My spouse and I stumbled

My spouse and I stumbled over here different web page
and thought I might as well check things out. I like what I
see so now i am following you. Look forward to exploring your web page for a second
time.

My brother suggested I might

My brother suggested I might like this blog. He was entirely right.
This post truly made my day. You cann't imagine just how much time
I had spent for this info! Thanks!

Feel free to surf to my page online pharmacies in canada

einstein. jabulaniholdings.

For the reason that the admin

For the reason that the admin of this web page is working, no hesitation very rapidly
it will be renowned, due to its quality contents.

Hi there friends, pleasant

Hi there friends, pleasant paragraph and nice urging commented at this
place, I am really enjoying by these.

Also visit my blog ... canadadrugsonline.com

Terrific web site you've in

Terrific web site you've in here.

Paragraph writing is also a

Paragraph writing is also a excitement, if
you be familiar with after that you can write or else it is complex to write.

s2slc. lovran-apartments.

Good day! Do you know if they

Good day! Do you know if they make any plugins to protect against hackers?
I'm kinda paranoid about losing everything I've worked hard on. Any suggestions?

Thanks for finally talking

Thanks for finally talking about >Válasz a hozzászólásra

Admiring the time and energy

Admiring the time and energy you put into your website and in depth information you present.

It's awesome to come across a blog every once in a while that isn't the same
out of date rehashed information. Fantastic read! I've bookmarked your site and I'm adding your RSS feeds to my Google account.

Hmm it seems like your site

Hmm it seems like your site ate my first comment (it was super
long) so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your blog.

I as well am an aspiring blog blogger but I'm still new to everything.
Do you have any recommendations for inexperienced blog
writers? I'd definitely appreciate it.

Take a look at my web site - prednisone

Incredibly user friendly

Incredibly user friendly site. Astounding details readily available on couple of gos to.

Wow that was strange. I just

Wow that was strange. I just wrote an extremely long comment but after I clicked submit my comment didn't show up.
Grrrr... well I'm not writing all that over again. Anyway, just
wanted to say fantastic blog!

With thanks! It is definitely

With thanks! It is definitely an astounding site!

Hi to every body, it's my

Hi to every body, it's my first pay a visit of this webpage; this website contains amazing and actually good information designed
for visitors.

sfcus. elitelaunch.

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.