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

Many thanks, this website is

Many thanks, this website is very practical.

Heya i am for the first time

Heya i am for the first time here. I came across this board and I find It really useful & it helped
me out a lot. I hope to give something back and help others like you helped me.

Thanks for

Thank you on your curiosity

Thank you on your curiosity in Funding Recommendation.

What's up, yeah this piece of

What's up, yeah this piece of writing is actually good and I have learned lot of things
from it regarding blogging. thanks.

Wow, beautiful portal. Thnx

Wow, beautiful portal. Thnx ...

Keep this going please, great

Keep this going please, great job!

Please let me know if you're

Please let me know if you're looking for a writer for your site.
You have some really great posts and I believe I would be
a good asset. If you ever want to take some of the load off, I'd absolutely love to write some material for your blog
in exchange for a link back to mine. Please shoot me an e-mail
if interested. Thank you!

Thanks for the good writeup.

Thanks for the good writeup. It in fact was
a enjoyment account it. Look complicated to far delivered
agreeable from you! However, how can we keep in touch?

say thanks to a lot for your

say thanks to a lot for your internet site it helps a great deal.

Do you have any video of

Do you have any video of that? I'd care to find out some additional information.

And that is an funding risk

And that is an funding risk worth taking.

Incredible! This blog looks

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

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

Having read this I believed

Having read this I believed it was rather informative.
I appreciate you finding the time and effort to put this content together.
I once again find myself spending a significant amount of
time both reading and commenting. But so what, it was still
worthwhile!

You've gotten one of the

You've gotten one of the better online sites.

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 set up
my own. Do you require any html coding expertise to make your own blog?
Any help would be really appreciated!

Great website! It looks

Great website! It looks extremely expert! Sustain the good job!

Hello there, just became

Hello there, just became alert to your blog through Google, and found
that it's really informative. I'm gonna watch out for brussels.
I'll appreciate if you continue this in future.
A lot of people will be benefited from your writing. Cheers!

We are a group of volunteers

We are a group of volunteers and opening a
brand new scheme in our community. Your site offered
us with valuable info to work on. You have done a
formidable process and our entire neighborhood will likely be grateful to you.

If some one wants expert view

If some one wants expert view about blogging afterward i suggest him/her to pay a quick visit this webpage, Keep up the pleasant job.

ysiaq. malosh.

It's remarkable designed for

It's remarkable designed for me to have a website, which
is valuable designed for my experience. thanks admin

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

I think that everything wrote

I think that everything wrote was very reasonable.
However, consider this, what if you added a little information? I
mean, I don't wish to tell you how to run your blog, however what if you added a title that grabbed people's attention?
I mean Válasz a hozzászólásra is a little boring.
You ought to glance at Yahoo's front page and note how
they write article titles to get people to click.
You might add a related video or a related picture or two to
grab readers excited about everything've got to say. In my opinion,
it might bring your website a little livelier.

You have got terrific

You have got terrific knowlwdge here.

kcwzz. sleepmoney.

Wow! This blog looks exactly

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

Appreciate this post. Let me

Appreciate this post. Let me try it out.

Hi, constantly i used to

Hi, constantly i used to check web site posts here in the early hours in the break of day,
since i enjoy to learn more and more.

I'm really inspired with your

I'm really inspired with your writing talents as well as with the layout in your blog.
Is this a paid subject matter or did you modify it your self?
Either way stay up the excellent quality writing, it's uncommon to look a nice weblog like this one these
days..

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

Sweet blog! I found it while

Sweet blog! I found it while searching on Yahoo
News. Do you have any suggestions on how to get listed in Yahoo News?
I've been trying for a while but I never seem to get there!
Thanks

What's happening, great

What's happening, great web-site you possess presently.

Hi there to all, it's really

Hi there to all, it's really a pleasant for me to pay a visit this site,
it contains precious Information.

Financial advisors business

Financial advisors business is folks business.

formlessro. azatweb.

Good day I am so thrilled I

Good day I am so thrilled I found your website, I really found you by mistake, while I was searching on Digg for something else, Anyhow I am
here now and would just like to say kudos for a remarkable
post and a all round enjoyable blog (I also love the theme/design), I don't
have time to browse it all at the minute but I
have book-marked it and also added in your RSS feeds,
so when I have time I will be back to read much more, Please do keep up the
fantastic work.

Great looking internet site.

Great looking internet site. Presume you did a bunch of your own coding.

I couldn't resist commenting.

I couldn't resist commenting. Very well written!

I like the helpful info you

I like the helpful info you provide in your articles.
I will bookmark your weblog and check again here regularly.

I am quite sure I will learn many new stuff right here!
Good luck for the next!

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.