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

Nice response in return of

Nice response in return of this matter with
solid arguments and telling the whole thing concerning that.

Hiya very cool website!! Man

Hiya very cool website!! Man .. Beautiful ..
Amazing .. I'll bookmark your website and take the feeds also?
I am glad to find a lot of helpful information right here in the post,
we'd like work out more techniques on this regard, thanks for sharing.
. . . . .

I'm not sure where you are

I'm not sure where you are getting your information, but good topic.
I needs to spend some time learning more or understanding more.

Thanks for magnificent info I was looking for this info
for my mission.

Pretty nice post. I just

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

Asking questions are actually

Asking questions are actually nice thing if you are not
understanding something completely, except this piece of writing provides
nice understanding yet.

Wonderful items from you,

Wonderful items from you, man. I've keep in mind your stuff prior
to and you are just extremely great. I actually
like what you have acquired here, certainly like
what you are stating and the way in which through
which you are saying it. You are making it enjoyable and you still care for to
stay it smart. I cant wait to read far more from you. That
is actually a terrific site.

If you want to take a great

If you want to take a great deal from this post then you have to apply these methods to your won website.

Every weekend i used to visit

Every weekend i used to visit this site, for the reason that i wish for enjoyment, since
this this website conations genuinely pleasant
funny data too.

Great post.

Great post.

Spot on with this write-up, I

Spot on with this write-up, I seriously think this website needs a great deal more attention.
I'll probably be back again to read through more, thanks for the information!

Heya! I understand this is

Heya! I understand this is sort of off-topic however I needed to ask.
Does operating a well-established blog like yours take a massive amount
work? I am brand new to blogging but I do write in my diary on a daily basis.

I'd like to start a blog so I can easily share my own experience and
views online. Please let me know if you have any suggestions or tips for new aspiring blog owners.
Appreciate it!

Hmm is anyone else

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

I love reading through a post

I love reading through a post that can make men and women think.

Also, thanks for allowing for me to comment!

Great delivery. Solid

Great delivery. Solid arguments. Keep up the
amazing effort.

These are genuinely fantastic

These are genuinely fantastic ideas in concerning blogging.

You have touched some fastidious factors here. Any way keep up wrinting.

I have been exploring for a

I have been exploring for a little for any high quality articles or weblog posts in this kind of area .

Exploring in Yahoo I at last stumbled upon this web site.

Studying this info So i'm satisfied to convey that I have an incredibly excellent uncanny feeling I discovered just what I needed.
I so much certainly will make certain to do not omit this site and give it
a look regularly.

whoah this weblog is

whoah this weblog is excellent i love studying your posts.
Stay up the great work! You understand, lots of persons are searching around
for this info, you can help them greatly.

An outstanding share! I've

An outstanding share! I've just forwarded this onto a colleague who has been doing a little homework on this.

And he in fact ordered me dinner due to the fact that I stumbled upon it for
him... lol. So allow me to reword this....
Thank YOU for the meal!! But yeah, thanx for spending the time to discuss this topic here on your blog.

I really like your blog..

I really like your blog.. very nice colors & theme.
Did you design this website yourself or did you hire someone to do it for
you? Plz answer back as I'm looking to design my own blog and would like to find out where u got this from.
thanks a lot

I really like it whenever

I really like it whenever people get together and share views.
Great blog, keep it up!

fantastic points altogether,

fantastic points altogether, you simply gained a new reader.
What would you recommend in regards to your post that you simply made a few days in the
past? Any sure?

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 appear.
Grrrr... well I'm not writing all that over again. Regardless, just wanted to
say excellent blog!

Good web site you've got

Good web site you've got here.. It's difficult to find good
quality writing like yours nowadays. I seriously appreciate people like
you! Take care!!

A financial advisor is your

A financial advisor is your planning associate.

I'm really enjoying the

I'm really enjoying the theme/design of your web site. Do you ever
run into any browser compatibility problems?

A couple of my blog readers have complained about my site not working correctly in Explorer but looks great in Firefox.

Do you have any tips to help fix this problem?

Howdy! This post couldn't be

Howdy! This post couldn't be written any better! Going through this post reminds me of my previous roommate!

He continually kept talking about this. I most certainly will
send this article to him. Pretty sure he will have a good read.
Many thanks for sharing!

I'm impressed, I have to

I'm impressed, I have to admit. Seldom do I encounter a
blog that's both equally educative and entertaining, and let me tell you, you've hit the nail on the head.

The problem is something that not enough folks are speaking
intelligently about. I am very happy I stumbled across this
during my hunt for something relating to this.

Thanks for your marvelous

Thanks for your marvelous posting! I seriously enjoyed reading it, you can be a great author.I will be sure to bookmark your blog and
definitely will come back later in life. I want to encourage one to continue your great writing, have
a nice evening!

Hi, Neat post. There's an

Hi, Neat post. There's an issue with your web site in internet explorer, would check this?
IE nonetheless is the market chief and a huge component of people will pass
over your wonderful writing because of this problem.

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 25 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 completely off topic
but I had to share it with someone!

Howdy! This is my 1st comment

Howdy! This is my 1st comment here so I just wanted to give a quick shout out and say I truly enjoy reading through your posts.
Can you suggest any other blogs/websites/forums that cover the same topics?
Appreciate it!

I think this is one of the

I think this is one of the most important information for me.
And i'm glad reading your article. But wanna remark on some general things, The site
style is great, the articles is really nice : D. Good job, cheers

Wow, awesome blog structure!

Wow, awesome blog structure! How lengthy have you ever been blogging for?
you made running a blog glance easy. The whole look of your website is great, as neatly as the content!

A monetary advisor is your

A monetary advisor is your planning associate.

Thank you for another

Thank you for another informative site. Where else may I am getting that kind of info written in such an ideal approach?
I have a project that I'm just now running on, and I have been on the glance out for
such info.

For latest information you

For latest information you have to pay a quick visit world wide web and on world-wide-web I found this site
as a most excellent web page for most up-to-date updates.

Hi there, just wanted to tell

Hi there, just wanted to tell you, I enjoyed this article.
It was inspiring. Keep on posting!

Hi, for all time i used to

Hi, for all time i used to check website posts here in the early hours
in the dawn, as i love to find out more and more.

Hi there friends, its

Hi there friends, its impressive post on the topic of educationand fully defined, keep it up all the
time.

Good web site you have got

Good web site you have got here.. It's difficult to find high-quality writing like yours these days.

I truly appreciate individuals like you! Take care!!

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 twenty five
foot drop, just so she can be a youtube sensation. My iPad is
now broken and she has 83 views. I know this is totally off topic but I had to share it with
someone!

And that is an investment

And that is an investment threat worth taking.

Hello there I am so glad I

Hello there I am so glad I found your web site,
I really found you by error, while I was browsing on Digg for something else, Nonetheless
I am here now and would just like to say
thank you for a marvelous post and a all round enjoyable blog (I also love the theme/design), I don’t have
time to look over it all at the minute but I have saved it
and also added in your RSS feeds, so when I have time
I will be back to read a lot more, Please do keep
up the awesome work.

I believe everything

I believe everything published made a ton of sense. But, think on this, suppose you
were to write a killer headline? I am not saying your information is not solid., but what if
you added a post title that grabbed folk's attention? I mean Válasz
a hozzászólásra is kinda vanilla. You could look at Yahoo's home
page and watch how they write post headlines to get
people to click. You might add a video or a picture or two to get people excited about what you've written. Just
my opinion, it could make your posts a little bit more interesting.

I'm extremely inspired along

I'm extremely inspired along with your writing skills as
smartly as with the format for your weblog. Is this a paid subject or
did you modify it your self? Either way keep up the excellent high quality writing, it's rare to see a nice weblog
like this one these days..

Hello would you mind sharing

Hello would you mind sharing which blog platform you're using?
I'm going to start my own blog in the near future
but I'm having a tough time selecting between BlogEngine/Wordpress/B2evolution and Drupal.
The reason I ask is because your design seems different then most
blogs and I'm looking for something unique.
P.S Apologies for being off-topic but I had to ask!

Hello there! This is my first

Hello there! 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 valuable information to work on. You have done a outstanding job!

It's amazing to go to see

It's amazing to go to see this site and reading the views of all mates on the
topic of this article, while I am also keen of getting experience.

My family members every time

My family members every time say that I am wasting my time
here at net, but I know I am getting experience all the time by
reading such good articles.

It's very effortless to find

It's very effortless to find out any topic on net as compared to books, as I found this article at this website.

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.