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

Kategória: 
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ó.

Hozzászólások

Superb post but I was wanting

Superb post but I was wanting to know if you could write a kdeaebkckfdf

happy to visit your website

happy to visit your website and can share information like my website that provides information about health for example,
Obat Herbal Penyakit Radang Lambung
Obat Sakit Ambeien Akut
Obat Herbal Penyakit Ambeien

Thanks for

information that should never

information that should never be on the miss , apart from that I also have Info Hebat
about health review that disease Tips Mengatasi Maag

I have learn a few just right

I have learn a few just right stuff here. Certainly worth bookmarking for revisiting.

I surprise how much effort you put to create this type of magnificent
informative site.

Also visit my blog ... pharmacy near me

Hello, I do think your blog

Hello, I do think your blog could possibly be having web browser compatibility problems.
Whenever I take a look at your website in Safari, it looks fine however
when opening in IE, it has some overlapping issues. I just wanted to provide you with a quick heads up!
Other than that, great website!

Also visit my web blog :: walmart pharmacy on

Yes! Finally something about

Yes! Finally something about prednisone 10mg taper directions.

My web-site; taking prednisone

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.

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

Appreciate this post. Let me

Appreciate this post. Let me try it out.

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

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

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

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

Ridiculous story there. What

Ridiculous story there. What occurred after?
Take care!

Have a look at my homepage :: prednisone

I'm gone to inform my little

I'm gone to inform my little brother, that he should also pay
a visit this blog on regular basis to get updated from newest news.

Feel free to visit my blog post :: prednisone

I was recommended this web

I was recommended this web site via my cousin. I
am not certain whether or not this put up is written by way of him as nobody else recognise such particular about my trouble.
You're incredible! Thank you!

Have a look at my web site ... cozaar medication

Have you ever considered

Have you ever considered about adding a little bit more than just your articles?
I mean, what you say is important and everything.

Nevertheless think of if you added some great
pictures or videos to give your posts more, "pop"! Your content is excellent but
with images and clips, this site could undeniably be one of the greatest
in its field. Fantastic blog!

Check out my weblog; prescription prices

This paragraph gives clear

This paragraph gives clear idea in support of the new users of blogging, that in fact how to do blogging.

Hey just wanted to give you a

Hey just wanted to give you a brief heads up and let you know a few
of the pictures aren't loading properly. I'm not sure why but
I think its a linking issue. I've tried it in two different browsers and both show the same results.

Feel free to surf to my blog - Canadian pharmacy

Thank you for some other

Thank you for some other informative site. The place else could I get that type of info written in such an ideal approach?
I've a mission that I am just now operating on, and I've been on the
glance out for such info.

Here is my webpage: Canadian pharmacy

I always spent my half an

I always spent my half an hour to read this webpage's posts daily along with a cup
of coffee.

Here is my blog: cialis coupons online

I am not sure where you're

I am not sure where you're getting your info, but great topic.
I needs to spend some time learning more or understanding more.
Thanks for great info I was looking for this information for my mission.

Review my page ... Canadian pharmacy

I seriously love your site..

I seriously love your site.. Great colors & theme. Did you create
this site yourself? Please reply back as I'm planning to
create my own website and would love to learn where you got this from or just what the theme is
called. Cheers!

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

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.

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

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

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.

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.

What's up, I log on to your

What's up, I log on to your blogs on a regular
basis. Your humoristic style is awesome, keep doing what you're doing!

I do not know if it's just me

I do not know if it's just me or if everybody else experiencing issues with your website.
It seems like some of the written text on your posts are running off the screen. Can somebody else please provide feedback and let me know if
this is happening to them too? This might be a problem with my browser
because I've had this happen previously. Appreciate it

Look into my website dyson dc24

If you desire to increase

If you desire to increase your familiarity simply keep visiting this web site and be updated
with the most recent news posted here.

Stop by my web blog - dyson replacement parts

I love your blog.. very nice

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

Here is my webpage - impotence remedy

Wow, that's what I was

Wow, that's what I was exploring for, what a information! present here
at this weblog, thanks admin of this web page.

My site ... northwestpharmacy com canada

whoah this blog is

whoah this blog is magnificent i love studying
your posts. Stay up the good work! You understand, lots of people are hunting around for this information, you could help them greatly.

Also visit my webpage cialis online pharmacy

Great web site. Lots of

Great web site. Lots of useful info here. I am sending it to several
friends ans additionally sharing in delicious. And obviously, thank you to
your sweat!

Have a look at my web-site tadalafil 20mg

At this moment I am going to

At this moment I am going to do my breakfast, after having my
breakfast coming again to read further news.

Look at my website - canadian drugs online

Generally I do not learn post

Generally I do not learn post on blogs, however I wish to say that this write-up very
forced me to check out and do it! Your writing taste has been amazed me.
Thanks, very great post.

My weblog; buy cialis in canada online

Greetings! This is my first

Greetings! This is my first comment here so I just wanted to give a quick shout out and
say I genuinely enjoy reading your articles. Can you
recommend any other blogs/websites/forums that go over the same subjects?
Thank you!

Here is my webpage - cialis online canada

Quality posts is the

Quality posts is the important to be a focus for the viewers to visit the site, that's what this web page is providing.

Here is my website: canadian pharmacy online

You actually make it seem so

You actually make it seem so easy with your presentation but I find this matter to be actually something that
I think I would never understand. It seems too complicated and very broad for me.

I am looking forward for your next post, I will try to get the
hang of it!

Also visit my web blog ... prescription medication

My brother suggested I may

My brother suggested I may like this web site.
He used to be totally right. This submit actually made my day.

You can not consider just how a lot time I had spent for this info!

Thanks!

my blog ... cialis in canada

Mondjuk lehet, hogy csak

Mondjuk lehet, hogy csak régen próbáltam, valahogy egyszerűbb volt a copypaste.
đăng ký w88
w88 cược trực tiếp
W88

Link exchange is nothing else

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

Here is my web page: buy cialis online pharmacy

Hello there! I could have

Hello there! I could have sworn I've been to this website before but after browsing through some of
the post I realized it's new to me. Nonetheless, I'm definitely glad I found it and I'll be
book-marking and checking back often!

Check out my web blog :: can you buy cialis over counter canada

You really make it appear so

You really make it appear so easy with your presentation however
I to find this matter to be really one thing that I feel I'd never understand.
It seems too complicated and extremely huge for me. I'm taking a look ahead on your subsequent post, I will attempt to get the
cling of it!

Here is my web site: buy cialis from canada

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…

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. :)

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.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.