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

Magnificent beat ! I wish to

Magnificent beat ! I wish to apprentice while you amend your site, how could i subscribe for a blog website?
The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast
offered bright clear concept

Hmm is anyone else having

Hmm is anyone else having problems with the
pictures on this blog loading? I'm trying to determine
if its a problem on my end or if it's the blog. Any feedback
would be greatly appreciated.

Nice post. I used to be

Nice post. I used to be checking continuously this blog and I am impressed!

Very helpful information specially the ultimate section :) I handle such info
much. I used to be seeking this certain information for a long
time. Thank you and good luck.

Hi there are using Wordpress

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

Ahaa, its pleasant dialogue

Ahaa, its pleasant dialogue on the topic of this
piece of writing at this place at this website, I have read all that, so now me also commenting at this place.

I know this if off topic but

I know this if off topic but I'm looking into starting my own blog and was wondering what all is
needed to get set up? I'm assuming having a blog
like yours would cost a pretty penny? I'm not very web smart so I'm not 100% certain. Any recommendations or advice would
be greatly appreciated. Cheers

Yesterday, while I was at

Yesterday, while I was at work, my sister stole my apple
ipad and tested to see if it can survive a 25 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 totally off topic but I had to share it
with someone!

Howdy would you mind letting

Howdy would you mind letting me know which web host you're
utilizing? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot faster then most.
Can you suggest a good web hosting provider at a honest price?
Cheers, I appreciate it!

Nice post. I learn something

Nice post. I learn something new and challenging on websites I stumbleupon every day.

It's always exciting to read content from other authors and use something from other websites.

I am no longer certain the

I am no longer certain the place you're getting your info, but good topic.
I needs to spend some time studying much more or understanding
more. Thank you for excellent info I was looking
for this info for my mission.

Hello, i feel that i saw you

Hello, i feel that i saw you visited my website thus
i came to return the prefer?.I'm trying to find issues to improve my site!I suppose its ok to make use
of a few of your ideas!!

I don't know if it's just me

I don't know if it's just me or if everyone else encountering
problems with your blog. It appears as though some of the written text in 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 may be a problem with my browser because I've had this
happen before. Thank you

I pay a visit everyday some

I pay a visit everyday some web sites and websites to read articles, however this weblog provides feature
based articles.

These are in fact great ideas

These are in fact great ideas in about blogging.
You have touched some nice points here. Any way keep up wrinting.

Thanks for one's marvelous

Thanks for one's marvelous posting! I really enjoyed reading it, you can be a great author.I will always
bookmark your blog and may come back in the foreseeable future.

I want to encourage yourself to continue your great posts, have a
nice morning!

Hi colleagues, how is

Hi colleagues, how is everything, and what you desire to say on the topic of this post,
in my view its in fact awesome designed for me.

This article is really a

This article is really a pleasant one it helps
new net people, who are wishing in favor of
blogging.

of course like your web-site

of course like your web-site but you have to test the spelling on several of your posts.
Several of them are rife with spelling problems and I find it
very bothersome to tell the truth then again I'll definitely
come back again.

excellent submit, very

excellent submit, very informative. I ponder why the other specialists of this sector don't notice this.
You should continue your writing. I'm sure, you have
a great readers' base already!

hello there and thank you for

hello there and thank you for your info – I've definitely picked up anything new from right here.
I did however expertise some technical issues using this
website, as I experienced to reload the web site many
times previous to I could get it to load correctly.
I had been wondering if your web host is OK? Not that I'm complaining, but sluggish loading instances
times will very frequently affect your placement in google and can damage your quality score if advertising and marketing with Adwords.
Well I am adding this RSS to my email and can look out
for much more of your respective interesting content. Make sure you update this again soon.

Awesome! Its actually awesome

Awesome! Its actually awesome article, I have got much clear idea on the
topic of from this article.

What's up all, here every

What's up all, here every person is sharing these kinds of knowledge, therefore it's
fastidious to read this web site, and I used to go to see
this blog every day.

Hey there I am so thrilled I

Hey there I am so thrilled I found your site, I really found you by error, while I was researching on Bing for something else, Anyways I
am here now and would just like to say many thanks for a remarkable post and a all round enjoyable blog (I also love the theme/design), I don't have time to go through it all at the
minute but I have book-marked it and also added your RSS feeds,
so when I have time I will be back to read much more,
Please do keep up the superb work.

I loved as much as you will

I loved as much as you will receive carried out right here.
The sketch is tasteful, your authored subject matter
stylish. nonetheless, you command get bought an nervousness over that you wish be delivering the following.
unwell unquestionably come more formerly again since exactly the same nearly a lot
often inside case you shield this hike.

Awesome post.

Awesome post.

Appreciate the

Appreciate the recommendation. Will try it out.

It's difficult to find

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

Incredible! This blog looks

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

It's not my first time to

It's not my first time to visit this web site, i am
visiting this website dailly and get nice facts from here daily.

I’m not that much of a

I’m not that much of a internet reader to be honest
but your blogs really nice, keep it up! I'll go ahead and bookmark
your website to come back later. Cheers

Hi everybody, here every

Hi everybody, here every person is sharing such know-how, therefore it's pleasant to read this
web site, and I used to pay a quick visit this weblog every day.

Do you mind if I quote a

Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your
blog? My blog is in the exact same area of interest as
yours and my users would definitely benefit from some of the information you present here.
Please let me know if this alright with you. Regards!

I every time spent my half an

I every time spent my half an hour to read this website's articles everyday along with a mug of
coffee.

For latest news you have to

For latest news you have to pay a quick visit internet and
on world-wide-web I found this website as a finest website for newest updates.

Hi, I do believe this is a

Hi, I do believe this is a great blog. 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 guide other people.

Remarkable! Its truly

Remarkable! Its truly remarkable paragraph, I have got much clear idea about from this post.

It's a pity you don't have a

It's a pity you don't have a donate button! I'd certainly donate to this superb blog!
I suppose for now i'll settle for book-marking and adding your RSS feed to my Google account.

I look forward to fresh updates and will share this website with my Facebook group.
Chat soon!

Hello it's me, I am also

Hello it's me, I am also visiting this website daily, this web site is genuinely fastidious and the viewers are truly sharing good thoughts.

I'm not sure why but this

I'm not sure why but this weblog is loading incredibly slow for me.
Is anyone else having this issue or is it a problem on my end?
I'll check back later on and see if the problem still exists.

Hey there, I think your blog

Hey there, I think your blog might be having browser compatibility issues.
When I look at your blog site in Ie, it looks fine but when opening
in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up! Other then that, terrific blog!

Howdy! I know this is kind of

Howdy! I know this is kind of off-topic however I needed to ask.

Does managing a well-established website such as yours require a large amount of work?
I'm brand new to operating a blog however I do write in my diary every
day. I'd like to start a blog so I will be able to share my own experience and
views online. Please let me know if you have any suggestions or tips for brand new
aspiring blog owners. Thankyou!

I'm truly enjoying the design

I'm truly enjoying the design and layout of your site. It's a very easy on the eyes which makes it much more pleasant for me to come
here and visit more often. Did you hire out a developer to create your theme?
Excellent work!

I read this piece of writing

I read this piece of writing completely about the difference of most up-to-date and earlier technologies, it's remarkable article.

I loved as much as you will

I loved as much as you will receive carried out right here.
The sketch is attractive, your authored subject matter stylish.

nonetheless, you command get bought an edginess over that you wish be delivering the following.
unwell unquestionably come more formerly again as exactly the same
nearly a lot often inside case you shield this increase.

I absolutely love your blog

I absolutely love your blog and find most of your post's to be what precisely
I'm looking for. Does one offer guest writers
to write content to suit your needs? I wouldn't mind writing a post or elaborating on a lot of the subjects you write regarding here.

Again, awesome website!

Oh my goodness! Amazing

Oh my goodness! Amazing article dude! Thank you, However I am experiencing difficulties with your RSS.

I don't know why I can't join it. Is there anybody else having identical
RSS issues? Anyone that knows the answer can you kindly respond?
Thanks!!

possibly situation cialis

possibly situation cialis early tradition
always anybody [url=http://cialislet.com]tadalafil 20mg[/url] here advantage
somewhat make rarely wish http://cialislet.com everywhere virus http://cialislet.com/

It's a shame you don't have a

It's a shame you don't have a donate button! I'd definitely donate to this brilliant blog!
I guess for now i'll settle for bookmarking and adding your RSS feed to
my Google account. I look forward to brand new updates and will talk about
this website with my Facebook group. Chat soon!

WOW just what I was searching

WOW just what I was searching for. Came here by searching for medical doctor

What i don't understood is in

What i don't understood is in fact how you are now not actually a lot more well-favored than you may be right now.

You are very intelligent. You already know therefore considerably when it comes to this topic,
produced me in my view believe it from so many various angles.
Its like men and women aren't interested unless it's something to do with Woman gaga!
Your personal stuffs excellent. At all times care for it up!

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.