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

Awesome article.

Awesome article.

Nice blog here! Also your web

Nice blog here! Also your web site loads up fast! What host are you
using? Can I get your affiliate link to your host?
I wish my website loaded up as fast as yours lol

Usually I do not read article

Usually I do not read article on blogs, however I wish to say that
this write-up very forced me to check out and do so! Your writing
style has been amazed me. Thank you, very great post.

After going over a number of

After going over a number of the blog posts on your website,
I really like your technique of blogging. I added it to my bookmark website list and will be checking back in the near future.
Please check out my web site as well and let me
know your opinion.

Wow! This blog looks exactly

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

Good day! I know this is

Good day! I know this is kinda off topic however , I'd figured I'd ask.

Would you be interested in trading links or maybe guest authoring a blog article or vice-versa?
My site covers a lot of the same subjects as yours and I
think we could greatly benefit from each other. If
you are interested feel free to send me an e-mail. I look forward to hearing from you!
Terrific blog by the way!

This is a topic that is close

This is a topic that is close to my heart... Cheers!
Exactly where are your contact details though?

Superb blog you have here but

Superb blog you have here but I was wondering if you knew of any message boards that cover the same topics discussed here?
I'd really love to be a part of group where I can get suggestions from other experienced individuals that share the same interest.

If you have any recommendations, please let me know.

Thanks a lot!

First of all I want to say

First of all I want to say wonderful blog! I had a quick question in which I'd like to
ask if you do not mind. I was curious to find out
how you center yourself and clear your thoughts before writing.
I've had a difficult time clearing my mind in getting my thoughts out there.

I truly do take pleasure in writing however it just seems like the first
10 to 15 minutes are wasted just trying to figure out how to begin. Any
recommendations or tips? Thank you!

Hello there, nice post ! I've

Hello there, nice post ! I've shared it with users on my website, and
they really liked it! Have a great day.

I'm gone to tell my little

I'm gone to tell my little brother, that he should also
go to see this webpage on regular basis to take updated from hottest information.

I just could not depart your

I just could not depart your web site before
suggesting that I really loved the usual info an individual provide
to your guests? Is gonna be again continuously in order
to check out new posts

I for all time emailed this

I for all time emailed this web site post page to all
my contacts, for the reason that if like to read it after that my links will too.

Cool blog! Is your theme

Cool 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 stand out. Please let me know where you got your
design. With thanks

These are really enormous

These are really enormous ideas in regarding blogging.
You have touched some good factors here. Any way keep up wrinting.

Way cool! Some very valid

Way cool! Some very valid points! I appreciate you writing this post and
also the rest of the website is extremely good.

cialis daily

cialis daily https://calis24.com/

I feel this is among the such

I feel this is among the such a lot vital information for me.
And i'm happy reading your article. But want to observation on few
general issues, The site taste is wonderful, the articles is truly great :
D. Just right task, cheers

Link exchange is nothing else

Link exchange is nothing else but it is simply placing the other person's webpage link on your page at
suitable place and other person will also do same for you.

I used to be able to find

I used to be able to find good advice from your blog articles.

Hi my loved one! I want to

Hi my loved one! I want to say that this post is amazing, great
written and include approximately all vital infos.

I'd like to see extra posts like this .

i like it great work it nice

i like it great work it nice it

hello there and thank you for

hello there and thank you for your info – I've certainly picked up anything new from right here.
I did however expertise a few technical issues
using this website, as I experienced to reload the 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 slow loading instances times will often affect your placement in google and can damage your quality score
if advertising and marketing with Adwords. Well I'm
adding this RSS to my e-mail and can look out for much more of your respective intriguing content.

Ensure that you update this again soon.

Wonderful beat ! I wish to

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

Undeniably believe that which

Undeniably believe that which you said. Your favorite justification seemed
to be on the web the simplest thing to be aware of.

I say to you, I definitely get annoyed while people think about worries that they just
don't know about. You managed to hit the nail upon the
top as well as defined out the whole thing without having side effect ,
people could take a signal. Will probably be back to get more.
Thanks

Hello would you mind stating

Hello would you mind stating which blog platform you're
using? I'm looking to start my own blog in the near future but I'm
having a difficult time deciding 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 getting off-topic but
I had to ask!

Hey! Would you mind if I

Hey! Would you mind if I share your blog with my twitter
group? There's a lot of people that I think would really
appreciate your content. Please let me know.

Thanks

Hey there are using Wordpress

Hey 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!

I blog often and I genuinely

I blog often and I genuinely appreciate your content.

The article has really peaked my interest. I am going to book mark your website and keep checking for new details
about once a week. I subscribed to your RSS feed too.

Wow, fantastic weblog format!

Wow, fantastic weblog format! How long have you ever been blogging for?
you make running a blog look easy. The overall
glance of your web site is magnificent, let alone the content!

When I initially left a

When I initially left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox
and from now on each time a comment is added I get 4 emails with the exact same comment.
Is there a means you are able to remove me from that service?
Thanks!

Truly when someone doesn't

Truly when someone doesn't understand afterward its up to other people that they will help, so here it occurs.

This blog was... how do you

This blog was... how do you say it? Relevant!! Finally I have found something which helped me.
Thanks!

I have to thank you for the

I have to thank you for the efforts you've put in penning this blog.

I'm hoping to view the same high-grade blog posts from you later on as well.
In truth, your creative writing abilities has motivated me to get my own, personal site now ;)

naturally like your web-site

naturally like your web-site but you have to test the spelling
on several of your posts. Many of them are rife with
spelling problems and I find it very troublesome to inform the reality however I will certainly come again again.

Wonderful, what a webpage it

Wonderful, what a webpage it is! This website presents helpful facts to us, keep it
up.

Excellent items from you,

Excellent items from you, man. I've take note
your stuff previous to and you are simply too magnificent.
I actually like what you have got right here, really like what you're stating and
the best way in which you are saying it. You are making it entertaining and you
continue to take care of to keep it smart.

I can't wait to read far more from you. That is really a terrific
site.

We're a group of volunteers

We're a group of volunteers and starting a new scheme in our community.
Your site provided us with valuable info to work on. You have done a formidable job and our entire community
will be thankful to you.

I blog often and I truly

I blog often and I truly appreciate your content.
The article has really peaked my interest. I will bookmark
your website and keep checking for new details about once per week.
I subscribed to your Feed as well.

Aw, this was an incredibly

Aw, this was an incredibly good post. Finding the time and
actual effort to generate a superb article… but what can I say… I
procrastinate a lot and never manage to get nearly anything done.

I'm really impressed with

I'm really impressed with your writing skills and also with
the layout on your weblog. Is this a paid theme or did you
customize it yourself? Anyway keep up the nice quality writing,
it's rare to see a nice blog like this one these days.

Hi there colleagues, how is

Hi there colleagues, how is everything, and what you
would like to say about this paragraph, in my view its really amazing in favor of me.

Great blog! Do you have any

Great blog! Do you have any tips for aspiring writers?
I'm planning to start my own site soon but I'm a little lost
on everything. Would you advise starting with
a free platform like Wordpress or go for a paid option? There are
so many choices out there that I'm totally overwhelmed ..
Any recommendations? Bless you!

Magnificent beat ! I would

Magnificent beat ! I would like to apprentice while you amend
your website, how could i subscribe for a weblog website?
The account aided me a appropriate deal. I have been tiny bit familiar of this your broadcast provided vivid clear idea

This is very interesting,

This is very interesting, You're a very skilled blogger.
I have joined your rss feed and look forward to seeking more
of your magnificent post. Also, I have shared your web
site in my social networks!

May I simply just say what a

May I simply just say what a relief to find somebody who truly knows what they are discussing
over the internet. You actually know how to bring a problem to light and make it important.
More people have to read this and understand this side of your
story. I can't believe you aren't more popular since you certainly have the
gift.

I am no longer positive where

I am no longer positive where you're getting
your information, however good topic. I must spend a while finding out much more or figuring out more.

Thanks for excellent info I used to be looking for this information for my
mission.

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.

Outstanding story there. What

Outstanding story there. What occurred after? Take care!

A fascinating discussion is

A fascinating discussion is worth comment. I believe that
you should write more on this subject matter, it may not be a taboo matter but generally
folks don't speak about such subjects. To the next! Best wishes!!

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.