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

This is really fascinating,

This is really fascinating, You are an excessively skilled blogger.
I've joined your rss feed and sit up for looking for more
of your wonderful post. Also, I have shared your site
in my social networks

Sweet blog! I found it while

Sweet blog! I found it while browsing 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

You can definitely see your

You can definitely see your skills in the work
you write. The world hopes for more passionate writers such as you who are not
afraid to say how they believe. Always go after your heart.

I used to be suggested this

I used to be suggested this blog via my cousin. I'm not sure whether or not this post is written by means of him as no one else understand
such exact about my difficulty. You are wonderful!
Thank you!

I don't know whether it's

I don't know whether it's just me or if perhaps everyone else experiencing
issues with your site. It looks like some of the written text within your content are running off
the screen. Can someone else please comment and let me know if this is happening to them
as well? This may be a problem with my web browser because I've had this happen before.
Kudos

freight forwarder france -

freight forwarder france - freight forwarder agent - freight forwarder queens ny - freight forwarder kota kinabalu - freight forwarder london

You ought to be a part of a

You ought to be a part of a contest for one of the greatest
sites on the web. I will recommend this web site!

freight forwarder charleston

freight forwarder charleston sc - freight forwarder mauritius - freight forwarder average salary - freight forwarder dallas - freight forwarder fremantle

With havin so much content do

With havin so much content do you ever run into any issues of plagorism or copyright
violation? My site has a lot of unique content I've either written myself or outsourced but it appears a lot of it
is popping it up all over the web without my
authorization. Do you know any solutions to help
reduce content from being ripped off? I'd truly appreciate it.

Hello, i read your blog from

Hello, i read your blog from time to time and i own a similar one and i was just wondering if
you get a lot of spam feedback? If so how do
you stop it, any plugin or anything you can suggest? I get so much lately it's driving me mad so any help is very much appreciated.

freight forwarder

freight forwarder christchurch - freight forwarder thailand to philippines - freight forwarder geodis - freight forwarder in bangladesh - freight forwarder canada

Hello, i think that i saw you

Hello, i think that i saw you visited my web site thus i came to “return the
favor”.I'm trying to find things to improve my web site!I suppose its ok to use some of your ideas!!

If you are going for most

If you are going for most excellent contents like me, just go to see this web page every day since it provides feature contents, thanks

freight forwarder e&o -

freight forwarder e&o - freight forwarder e&o - freight forwarder license canada - freight forwarder seattle - freight forwarder united states

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 fantastic 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 share
this website with my Facebook group. Talk soon!

No matter if some one

No matter if some one searches for his essential
thing, thus he/she wishes to be available that in detail, so that thing is maintained over here.

freight forwarder ontario -

freight forwarder ontario - freight forwarder usa to singapore - freight forwarding xpo - freight forwarder geodis - freight forwarder china

It's really a cool and

It's really a cool and helpful piece of information. I am glad that you just shared this
useful info with us. Please stay us up to date like this.
Thanks for sharing.

Superb post but I was wanting

Superb post but I was wanting to know if you could write a litte more on this subject?
I'd be very grateful if you could elaborate a little bit further.

Appreciate it!

I was recommended this

I was recommended this website by way of my cousin. I'm no longer certain whether
this post is written by means of him as nobody else know such certain about my
difficulty. You're incredible! Thank you!

My brother suggested I might

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

Hello! I could have sworn

Hello! I could have sworn I've been to this web site before but after looking
at many of the posts I realized it's new to me. Nonetheless, I'm
definitely pleased I came across it and I'll be bookmarking it and
checking back often!

I'm extremely impressed with

I'm extremely impressed with your writing skills as well as with the layout on your blog.

Is this a paid theme or did you customize it yourself?

Either way keep up the excellent quality writing, it is rare to
see a nice blog like this one these days.

Hi there to all, how is the

Hi there to all, how is the whole thing, I think every one is getting
more from this web site, and your views are fastidious in support of new people.

freight forwarder seattle -

freight forwarder seattle - freight forwarder franchise - freight forwarder sic code - freight forwarder franchise - freight forwarder odessa ukraine

Keep on writing, great job!

Keep on writing, great job!

freight forwarder work -

freight forwarder work - freight forwarder salary - freight forwarder san diego - freight forwarder west palm beach - freight forwarder halifax

Everything is very open with

Everything is very open with a really clear explanation of
the challenges. It was really informative. Your website is extremely helpful.
Thanks for sharing!

Way cool! Some extremely

Way cool! Some extremely valid points! I appreciate you penning this write-up and also the rest of the website is really good.

I needed to thank you for

I needed to thank you for this excellent read!!
I definitely enjoyed every bit of it. I have got you book marked to look at new
stuff you post…

Hi! I simply wish to offer

Hi! I simply wish to offer you a huge thumbs up for the excellent information you have right here on this post.
I am returning to your blog for more soon.

freight forwarder usa to

freight forwarder usa to india - freight forwarder mauritius - freight forwarder san diego - freight forwarder usa to thailand - freight forwarder naics code

I'm truly enjoying the design

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

Hello i am kavin, its my

Hello i am kavin, its my first occasion to commenting
anywhere, when i read this article i thought
i could also make comment due to this brilliant post.

It's the best time to make a

It's the best time to make a few plans for the future and it's time to be happy.
I've read this submit and if I may just I wish to suggest you some attention-grabbing things or tips.
Perhaps you can write next articles regarding this article.
I desire to read more things about it!

freight forwarder amazon -

freight forwarder amazon - freight forwarder books - freight forwarder in singapore - freight forwarder washington state - freight forwarder jobs london

Admiring the commitment you

Admiring the commitment you put into your blog and in depth information you provide.
It's nice to come across a blog every once in a while
that isn't the same outdated rehashed material. Great
read! I've bookmarked your site and I'm
including your RSS feeds to my Google account.

freight forwarder egypt -

freight forwarder egypt - freight forwarder vs broker - freight forwarder uk to australia - freight forwarder usa to singapore - freight forwarder vs logistics

May I simply say what a

May I simply say what a relief to discover somebody that really understands what they're discussing over the internet.
You certainly understand how to bring an issue to light and make it important.
A lot more people ought to read this and understand this side
of your story. I can't believe you are not more
popular because you most certainly possess the gift.

freight forwarder from usa to

freight forwarder from usa to uk - freight forwarder forum - freight forwarder glasgow - freight forwarder jobs in delhi - freight forwarder zurich

I am regular visitor, how are

I am regular visitor, how are you everybody? This paragraph posted at this web site is
actually fastidious.

freight forwarder courses -

freight forwarder courses - freight forwarder jobs in delhi - freight forwarder manager salary - freight forwarder panama - freight forwarder nigeria

This is very interesting,

This is very interesting, You're a very skilled blogger.
I've joined your feed and look forward to seeking more of your great post.
Also, I've shared your website in my social networks!

freight forwarder jobs uk -

freight forwarder jobs uk - freight forwarder exam - freight forwarder queensland - freight forwarder alaska - freight forwarder alibaba

freight forwarders for

freight forwarders for thailand - freight forwarder new york jobs - freight forwarder utah - freight forwarder jobs in canada - freight forwarder manager salary

It's amazing in support of me

It's amazing in support of me to have a web site,
which is valuable in support of my experience. thanks admin

freight forwarder washington

freight forwarder washington state - freight forwarder duties - freight forwarder world ranking - freight forwarder jobs in karachi - freight forwarder association thailand

Thank you for sharing your

Thank you for sharing your thoughts. I truly appreciate your efforts and I am waiting for your further post thanks once again.

freight forwarder ohio -

freight forwarder ohio - freight forwarder san francisco - freight forwarder mauritius - freight forwarder nigeria - freight forwarder singapore

I don't even know how I ended

I don't even know how I ended up here, but I thought this post was good.
I don't know who you are but certainly you're going to a famous blogger
if you are not already ;) Cheers!

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.