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

Thanks for your personal

Thanks for your personal marvelous posting! I truly enjoyed reading it, you're
a great author.I will be sure to bookmark your blog and will eventually come back very soon. I want
to encourage you to definitely continue your great writing, have a nice holiday weekend!

freight forwarder thailand

freight forwarder thailand list - freight forwarder new jersey - freight forwarder 8nv - freight forwarder names - freight forwarder books

ルイヴィトンコピー,ブランドコピー,スーパーコピーブランド

ルイヴィトンコピー,ブランドコピー,スーパーコピーブランド,スーパーブランドコピー財布,ブランドコピーバッグ

freight forwarder resume -

freight forwarder resume - freight forwarder license - freight forwarder south africa - freight forwarder liverpool - freight forwarder sydney

I have been exploring for a

I have been exploring for a little for any high-quality articles or weblog posts on this kind of space .
Exploring in Yahoo I finally stumbled upon this site.

Reading this information So i'm satisfied to express that
I have an incredibly excellent uncanny feeling I found out just what I needed.
I most indisputably will make sure to don?t put out
of your mind this site and give it a glance on a continuing basis.

freight forwarder tampa -

freight forwarder tampa - freight forwarder pakistan - freight forwarder mexico - freight forwarder hazardous material - freight forwarder jobs edmonton

Hurrah, that's what I was

Hurrah, that's what I was seeking for, what a information!
existing here at this website, thanks admin of this web site.

freight forwarder authority -

freight forwarder authority - freight forwarder description - freight forwarder oakland - freight forwarder winnipeg - freight forwarder power of attorney

Your style is very unique

Your style is very unique compared to other people I have
read stuff from. Many thanks for posting when you've
got the opportunity, Guess I'll just book mark this blog.

Hi there Dear, are you truly

Hi there Dear, are you truly visiting this site on a regular basis, if so after that
you will without doubt take fastidious know-how.

freight forwarder surabaya -

freight forwarder surabaya - freight forwarder hong kong to philippines - freight forwarder in zamboanga city - freight forwarder kpi - freight forwarder yokohama

Fascinating blog! Is your

Fascinating blog! Is your theme custom made or did you download it from somewhere?
A theme like yours with a few simple adjustements would really make
my blog shine. Please let me know where you got your theme.
Many thanks

freight forwarder fedex -

freight forwarder fedex - freight forwarder yerevan - freight forwarder switzerland - freight forwarder jakarta - freight forwarder klang

This website truly has all

This website truly has all the info I needed concerning this subject
and didn't know who to ask.

What's up to all, how is all,

What's up to all, how is all, I think every one is getting more
from this site, and your views are fastidious for new people.

I really like it when people

I really like it when people get together and share ideas.
Great blog, continue the good work!

freight forwarder ebay -

freight forwarder ebay - freight forwarder zambia - freight forwarder expo - freight forwarder queens ny - freight forwarder vs customs broker

freight forwarder thailand to

freight forwarder thailand to singapore - freight forwarder traduction - freight forwarder - freight forwarder utah - freight forwarder settlement

It's really very complex in

It's really very complex in this full of activity
life to listen news on TV, thus I just use internet for that reason,
and take the latest news.

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 obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be
giving us something enlightening to read?

freight forwarder qingdao

freight forwarder qingdao china - freight forwarder association thailand - freight forwarder website - freight forwarder bangkok - freight forwarder training

freight forwarder miami -

freight forwarder miami - freight forwarder dubai - freight forwarder jobs db - freight forwarder scams - freight forwarder guam

I used to be suggested this

I used to be suggested this blog by way of my cousin. I am no
longer sure whether this publish is written by means of him as
no one else recognise such specific about my
problem. You are wonderful! Thank you!

My family members all the

My family members all the time say that I am killing my time here at net, but I know I am getting know-how all the time by reading such
pleasant posts.

Hello there, just became

Hello there, just became aware of your blog through Google, and found that it's truly informative.
I'm gonna watch out for brussels. I'll appreciate if you
continue this in future. Numerous people will be benefited from your writing.

Cheers!

N級品グッチベルトとエルメスベルト新作の大特集、セール開催

N級品グッチベルトとエルメスベルト新作の大特集、セール開催中! 新作毎日入荷!使用感はございますが、

freight forwarder law -

freight forwarder law - freight forwarder nigeria - freight forwarder responsibilities - freight forwarder geelong - freight forwarder thailand to singapore

union freight forwarders

union freight forwarders thailand - freight forwarder from china to usa - freight forwarder jobs in delhi - freight forwarding xpo - freight forwarder payment terms

freight forwarder long beach

freight forwarder long beach - freight forwarder deutsch - freight forwarder dubai - freight forwarder mauritius - freight forwarder bangkok

Hey I know this is off topic

Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog that automatically tweet
my newest twitter updates. I've been looking for a plug-in like this for quite
some time and was hoping maybe you would have some
experience with something like this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your new updates.

Aw, this was a very nice

Aw, this was a very nice post. Taking the time and actual effort to
create a very good article… but what can I say… I
procrastinate a lot and don't seem to get anything done.

freight forwarder vietnam -

freight forwarder vietnam - freight forwarder platform - freight forwarder rotterdam - freight forwarder and clearing agent - sky freight forwarders yanbu

freight forwarder seattle -

freight forwarder seattle - freight forwarder selection criteria - freight forwarder west gosford - freight forwarder fremantle - freight forwarder europe

Hi! Would you mind if I share

Hi! Would you mind if I share your blog with my myspace group?

There's a lot of people that I think would really enjoy your content.
Please let me know. Cheers

freight forwarder charleston

freight forwarder charleston sc - freight forwarder us to singapore - freight forwarder queens ny - freight forwarder ebay - freight forwarder to canada

freight forwarder operator -

freight forwarder operator - freight forwarder ohio - freight forwarder role - freight forwarder nvocc - freight forwarder jobs

Hi everyone, it's my first

Hi everyone, it's my first pay a quick visit at this site, and article is truly fruitful in favor of me, keep
up posting such articles.

Today, while I was at work,

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

freight forwarder hiring in

freight forwarder hiring in paranaque - freight forwarder addresses - freight forwarder usa to mexico - freight forwarder georgia - freight forwarder books

freight forwarder quiz -

freight forwarder quiz - freight forwarder yogyakarta - freight forwarder pakistan - freight forwarder bond - freight forwarder jobs in delhi

I am in fact thankful to the

I am in fact thankful to the owner of this site who has shared this great paragraph at at this time.

freight forwarder brisbane -

freight forwarder brisbane - freight forwarder boston - freight forwarder in thailand - freight forwarder worldwide - freight forwarder near me

freight forwarder egypt -

freight forwarder egypt - freight forwarder what is - freight forwarder group - freight forwarder china to australia - freight forwarders kenya

It is appropriate time to

It is appropriate time to make some plans
for the future and it's time to be happy. I have read this post and if
I could I desire to suggest you some interesting things or
tips. Perhaps you could write next articles referring to this article.
I want to read more things about it!

freight forwarder pantip -

freight forwarder pantip - freight forwarder wage - freight forwarder thailand - freight forwarder pantip - freight forwarder san diego

freight forwarder ottawa -

freight forwarder ottawa - freight forwarder perth - freight forwarder china - sky freight forwarders yanbu - freight forwarder kuehne nagel

If some one wishes expert

If some one wishes expert view regarding blogging afterward i propose him/her to go to see this webpage, Keep up the good job.

freight forwarder vs carrier

freight forwarder vs carrier - freight forwarder miami - freight forwarder san francisco - freight forwarder names - freight forwarder quote online

What i don't understood is in

What i don't understood is in fact how you're no longer actually
a lot more well-appreciated than you might be now.
You're so intelligent. You know therefore significantly on the subject of this subject, made me in my
opinion imagine it from a lot of varied angles.

Its like men and women aren't involved except it's something to do with Girl gaga!
Your own stuffs great. At all times deal with it up!

Hi! This post couldn't be

Hi! This post couldn't be written any better! Reading through this post reminds me of my old room
mate! He always kept talking about this. I will
forward this page to him. Fairly certain he will have a good read.

Thanks for sharing!

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.