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

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

スーパーコピー時計、ブランド時計コピー通販、コピー時計N級

スーパーコピー時計、ブランド時計コピー通販、コピー時計N級品藤井店

We're a gaggle of volunteers

We're a gaggle of volunteers and starting a brand new scheme in our community.
Your website offered us with helpful information to work
on. You have performed a formidable process and
our whole community shall be grateful to you.

When someone writes an piece

When someone writes an piece of writing he/she maintains the plan of a
user in his/her mind that how a user can be aware of it.

Thus that's why this article is outstdanding.
Thanks!

The other day, while I was at

The other day, while I was at work, my sister stole my iphone and tested to see
if it can survive a thirty foot drop, just so she can be
a youtube sensation. My apple ipad is now destroyed and
she has 83 views. I know this is completely
off topic but I had to share it with someone!

スーパーコピーブランド スーパーコピーブランド 通販

スーパーコピーブランド スーパーコピーブランド 通販 ブランドスーパーコピー激安 スーパーコピーブランド販売

ブランドスーパーコピー買取!スーパーコピーブランド激安販売

ブランドスーパーコピー買取!スーパーコピーブランド激安販売

ブランドバッグコピー,ブランドコピーは本物と同じ素材を採用

ブランドバッグコピー,ブランドコピーは本物と同じ素材を採用しています,ご安心に購入して ...

Schwab Intelligent Portfolios

Schwab Intelligent Portfolios invests in Schwab ETFs.

constantly i used to read

constantly i used to read smaller articles which as well clear their motive, and that is also happening with this piece of writing which I am reading now.

Hi! This is my first visit to

Hi! This is my first visit to your blog! We are a team of volunteers
and starting a new initiative in a community in the
same niche. Your blog provided us beneficial information to work on. You have done
a wonderful job!

I love what you guys tend to

I love what you guys tend to be up too. This sort of
clever work and coverage! Keep up the amazing works guys I've
incorporated you guys to blogroll.

Hey there just wanted to give

Hey there just wanted to give you a quick heads up. The words
in your post seem to be running off the screen in Chrome.
I'm not sure if this is a formatting issue or something to do with web browser compatibility but I
figured I'd post to let you know. The design and style look great though!
Hope you get the problem solved soon. Kudos

An impressive share! I've

An impressive share! I've just forwarded this onto a co-worker who has
been conducting a little homework on this. And he actually bought me lunch
due to the fact that I discovered it for him... lol. So let me reword this....
Thank YOU for the meal!! But yeah, thanks for spending time to talk about this
topic here on your site.

I am truly grateful to the

I am truly grateful to the holder of this web site who has shared this
impressive paragraph at at this place.

Hello! I simply wish to give

Hello! I simply wish to give you a huge thumbs up for the great information you have here on this post.
I'll be coming back to your blog for more soon.

I always emailed this web

I always emailed this web site post page to all my associates, because if like to read it after
that my friends will too.

I blog quite often and I

I blog quite often and I genuinely thank you for your information. Your article has truly peaked my interest.
I am going to take a note of your site and keep checking
for new details about once per week. I subscribed to your Feed as well.

I like what you guys are

I like what you guys are usually up too. Such clever work
and exposure! Keep up the great works guys I've included you guys to my
personal blogroll.

Great site you have got

Great site you have got here.. It's hard to find high quality writing like yours nowadays.
I seriously appreciate people like you! Take care!!

hey there and thank you for

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

Hey! Someone in my Facebook

Hey! Someone in my Facebook group shared this
site with us so I came to check it out. I'm
definitely enjoying the information. I'm book-marking and will
be tweeting this to my followers! Fantastic blog and brilliant design and style.

スーパーコピーiPhone7ケースブランド

スーパーコピーiPhone7ケースブランド 携帯カバー手帳型通販,ショッピングモール!

My brother recommended I

My brother recommended I might like this web
site. He was totally right. This post truly made my day.
You can not imagine simply how much time I had spent for this information! Thanks!

iphone7 ケースシャネル,

iphone7 ケースシャネル, iphone7ケースルイヴィトン,iPhone7ケースグッチ手帳型携帯カバーショッピングサイト,通販サイト.

Pretty nice post. I just

Pretty nice post. I just stumbled upon your weblog
and wanted to say that I've really enjoyed surfing around your blog posts.
In any case I'll be subscribing to your rss feed and I hope you
write again soon!

This info is invaluable. When

This info is invaluable. When can I find out more?

Thanks to your interest in

Thanks to your interest in Investment Recommendation.

I take pleasure in, result in

I take pleasure in, result in I discovered just what I was taking a look for.
You have ended my 4 day lengthy hunt! God Bless you man. Have
a great day. Bye

Hello, Neat post. There is a

Hello, Neat post. There is a problem with your site in internet explorer,
might check this? IE nonetheless is the marketplace
chief and a huge component to other folks will pass over
your wonderful writing because of this problem.

It's an remarkable post for

It's an remarkable post for all the internet users; they will obtain benefit from it I am sure.

Hi i am kavin, its my first

Hi i am kavin, its my first occasion to commenting anywhere, when i read this post
i thought i could also make comment due to this sensible paragraph.

Have you ever thought about

Have you ever thought about creating an ebook or guest authoring on other blogs?

I have a blog centered on the same ideas you discuss and would love to have you share some stories/information. I know my subscribers would enjoy your work.
If you are even remotely interested, feel free to shoot me an e mail.

hello!,I love your writing

hello!,I love your writing very much! share we keep in touch
extra approximately your article on AOL? I need a specialist
on this space to unravel my problem. Maybe that is you!

Looking ahead to see you.

My brother suggested I might

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

禁無断複製、無断転載。このホームページに掲載されている記事

禁無断複製、無断転載。このホームページに掲載されている記事写真図表などの無断転載を禁じます。

Wow that was unusual. I just

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

Hello my friend! I want to

Hello my friend! I want to say that this post
is awesome, great written and include approximately all vital
infos. I'd like to see extra posts like this .

Hi there, I enjoy reading

Hi there, I enjoy reading through your article. I wanted
to write a little comment to support you.

It's remarkable to pay a

It's remarkable to pay a visit this web page and reading
the views of all colleagues on the topic of this piece
of writing, while I am also keen of getting experience.

Hi there Dear, are you truly

Hi there Dear, are you truly visiting this site daily, if so then you will without doubt obtain nice knowledge.

Hello There. I discovered

Hello There. I discovered your weblog the use of msn. This
is an extremely neatly written article. I will be sure to bookmark it and return to read more of your
useful info. Thanks for the post. I will certainly return.

Howdy! I know this is kind of

Howdy! 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 issues
with hackers and I'm looking at options for another platform.
I would be great if you could point me in the direction of a good platform.

And this is an investment

And this is an investment danger price taking.

I like the helpful

I like the helpful information you provide in your articles.
I'll bookmark your weblog and check again here frequently.
I am quite certain I'll learn a lot of new stuff right here!
Good luck for the next!

Asking questions are actually

Asking questions are actually pleasant thing if you are not understanding
something entirely, except this post offers pleasant understanding yet.

Wonderful blog! I found it

Wonderful blog! I found it while surfing around on Yahoo News.
Do you have any tips on how to get listed in Yahoo News?
I've been trying for a while but I never seem to get there!
Many thanks

I was suggested this web site

I was suggested this web site by means of my cousin. I am now not positive whether this submit is written through him
as nobody else recognize such unique about my difficulty.
You are wonderful! Thank you!

Hello, I would like to

Hello, I would like to subscribe for this web site
to take latest updates, thus where can i do it please help.

Howdy would you mind sharing

Howdy would you mind sharing which blog platform you're working with?
I'm planning to start my own blog in the near future but I'm
having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your layout seems
different then most blogs and I'm looking for something unique.

P.S Sorry for getting off-topic but I had to ask!

Buyers do pay direct and

Buyers do pay direct and oblique prices.

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.