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

I am actually happy to read

I am actually happy to read this weblog posts which includes
plenty of helpful data, thanks for providing such statistics.

If some one wants to be

If some one wants to be updated with latest technologies then he must be visit this site and be up to date all the time.

Hey! I just wanted to ask if

Hey! I just wanted to ask if you ever have any trouble with hackers?
My last blog (wordpress) was hacked and I ended
up losing many months of hard work due to no data backup.
Do you have any solutions to prevent hackers?

Feel free to surf to my webpage; Cialis online from us pharmacy

I'd like to thank you for the

I'd like to thank you for the efforts you have put in penning this website.
I really hope to see the same high-grade content from you later
on as well. In truth, your creative writing abilities has encouraged me to
get my own, personal site now ;)

What's up, good internet site

What's up, good internet site you have got at this time there.

Hi, I do think this is a

Hi, I do think this is a great web site. I stumbledupon it ;
) I am going to return yet again since i have bookmarked it.
Money and freedom is the greatest way to change, may you be rich and
continue to help others.

Whoa! This blog looks exactly

Whoa! This blog looks exactly like my old one! It's on a totally
different subject but it has pretty much the same page layout and design. Great choice of colors!

I am regular reader, how are

I am regular reader, how are you everybody? This paragraph posted at this
web page is truly pleasant.

Admiring the time and energy

Admiring the time and energy you put into your blog and detailed information you offer.
It's awesome to come across a blog every once in a while that isn't the
same unwanted rehashed material. Great read! I've bookmarked your
site and I'm including your RSS feeds to my Google account.

wonderful points altogether,

wonderful points altogether, you simply received a emblem new
reader. What would you recommend about your
publish that you simply made some days in the
past? Any sure?

Write more, thats all I have

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point.
You clearly know what youre talking about, why throw away your intelligence on just posting videos to
your weblog when you could be giving us something informative to read?

I don't know whether it's

I don't know whether it's just me or if perhaps everyone
else encountering issues with your site. It appears like some of the written text in your content are running off the screen. Can someone else please comment and
let me know if this is happening to them too? This could be a problem
with my internet browser because I've had this happen previously.

Cheers

edu. steerhome.

I've been browsing online

I've been browsing online more than three hours today, yet I never found any interesting article like
yours. It is pretty worth enough for me. In my view, if all website owners and bloggers made good content as you did, the net will
be a lot more useful than ever before.

Spot on with this write-up, I

Spot on with this write-up, I truly feel this web site needs a lot more attention.
I'll probably be returning to read through more, thanks for the
info!

Ahaa, its good discussion

Ahaa, its good discussion about this piece of writing here at this webpage, I have read all that, so now me
also commenting here.

My brother suggested I would

My brother suggested I would possibly like this website. He was
entirely right. This post actually made my day. You cann't
believe just how much time I had spent for this info!

Thanks!

Have a look at my web-site :: Cialis soft tabs online pharmacy

It's nearly impossible to

It's nearly impossible to find educated people in this particular subject, but you sound like
you know what you're talking about! Thanks

Howdy! Do you know if they

Howdy! Do you know if they make any plugins to safeguard against hackers?

I'm kinda paranoid about losing everything I've worked hard on. Any
tips?

You've gotten the most

You've gotten the most impressive sites.

Howdy, There's no doubt that

Howdy, There's no doubt that your site might be having web browser compatibility problems.
Whenever I take a look at your site in Safari, it looks fine however, if opening
in Internet Explorer, it has some overlapping issues. I merely wanted to provide you
with a quick heads up! Besides that, wonderful website!

I was curious if you ever

I was curious if you ever considered changing the structure of your blog?
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 one or 2 pictures.
Maybe you could space it out better?

Thanks with regard to

Thanks with regard to furnishing this sort of very good information.

I'm pretty pleased to find

I'm pretty pleased to find this site. I wanted to thank you
for your time for this particularly wonderful read!!
I definitely enjoyed every bit of it and i also have you bookmarked to check out new stuff in your web site.

I am really impressed

I am really impressed together with your writing skills and
also with the layout in your blog. Is that this a paid subject or did
you modify it yourself? Either way keep up the excellent high quality writing,
it's uncommon to peer a great weblog like this one nowadays..

What's up to every one, it's

What's up to every one, it's truly a fastidious for me to visit this website, it includes precious Information.

Greetings from Idaho! I'm

Greetings from Idaho! I'm bored to tears at work so I decided to check out your
website on my iphone during lunch break. I enjoy the information you
present here and can't wait to take a look when I get home.
I'm shocked at how fast your blog loaded on my cell phone ..
I'm not even using WIFI, just 3G .. Anyhow, very good blog!

I know this if off topic but

I know this if off topic but I'm looking into starting my
own weblog and was curious what all is needed to get setup?
I'm assuming having a blog like yours would cost a pretty penny?
I'm not very internet smart so I'm not 100% positive.
Any recommendations or advice would be greatly appreciated.
Appreciate it

Feel free to visit my homepage ... dyson dc24

You've got the most

You've got the most impressive webpages.

Hi to all, how is the whole

Hi to all, how is the whole thing, I think every one is getting more
from this web page, and your views are fastidious in support of new people.

kcwzz. catalinchiru.

Good day! I simply wish to

Good day! I simply wish to give you a huge thumbs up for your
great information you have right here on this post.

I will be coming back to your website for more soon.

I pay a quick visit everyday

I pay a quick visit everyday a few sites and websites to read posts, except
this web site provides quality based posts.

Asking questions are truly

Asking questions are truly good thing if you are not
understanding something completely, except this piece of writing offers nice understanding yet.

Hey there! I know this is

Hey there! I know this is kind of off topic but I was wondering which blog platform
are you using for this site? I'm getting tired of Wordpress because I've had problems with hackers and I'm looking at alternatives for another platform.
I would be great if you could point me in the direction of a good platform.

I love what you guys are up

I love what you guys are up too. Such clever work and exposure!
Keep up the awesome works guys I've incorporated you guys
to my blogroll.

It's remarkable to pay a

It's remarkable to pay a quick visit this web site and reading
the views of all friends concerning this paragraph, while I
am also zealous of getting knowledge.

Your material is amazingly

Your material is amazingly helpful.

Greetings! Very useful advice

Greetings! Very useful advice in this particular post!
It is the little changes that make the most significant changes.

Many thanks for sharing!

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.