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

It's awesome to go to see

It's awesome to go to see this site and
reading the views of all mates on the topic of
this piece of writing, while I am also zealous of getting familiarity.

My family members always say

My family members always say that I am wasting
my time here at web, but I know I am getting experience daily by reading such nice
posts.

Aw, this was an exceptionally

Aw, this was an exceptionally nice post. Taking a few minutes and actual
effort to create a very good article… but what can I say… I procrastinate a whole lot and don't
manage to get anything done.

Remarkable! Its really

Remarkable! Its really awesome post, I have got much clear idea concerning from this post.

Quality articles or reviews

Quality articles or reviews is the crucial to attract
the visitors to pay a visit the website, that's what this website is providing.

Hi! Someone in my Facebook

Hi! Someone in my Facebook group shared this website with us so
I came to look it over. I'm definitely loving the
information. I'm bookmarking and will be tweeting this to my followers!
Fantastic blog and brilliant design and style.

WOW just what I was looking

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

Excellent article. I'm

Excellent article. I'm experiencing a few of these issues as well..

Very nice post. I just

Very nice post. I just stumbled upon your blog and wished to
say that I have truly enjoyed browsing your weblog posts.
In any case I'll be subscribing on your feed and I hope you write once more soon!

Have you ever considered

Have you ever considered about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.
But think of if you added some great images or videos to
give your posts more, "pop"! Your content is excellent but with pics and videos,
this site could certainly be one of the most beneficial in its field.

Great blog!

Thanks designed for sharing

Thanks designed for sharing such a nice
opinion, piece of writing is pleasant, thats why i have read it completely

These are really great ideas

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

Greetings! Very useful advice

Greetings! Very useful advice within this article! It is the
little changes that make the greatest changes. Thanks for sharing!

I am genuinely glad to glance

I am genuinely glad to glance at this webpage posts which consists of
plenty of useful information, thanks for providing
such information.

My partner and I stumbled

My partner and I stumbled over here different
web page and thought I may as well check things out.
I like what I see so now i am following you. Look forward to
looking at your web page for a second time.

Hey there I am so grateful I

Hey there I am so grateful I found your site, I really found
you by mistake, while I was looking on Askjeeve for
something else, Regardless I am here now and would just like to
say thanks for a incredible post and a all round
interesting blog (I also love the theme/design), I don’t have
time to browse it all at the minute but I have saved 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 excellent b.

I think everything posted

I think everything posted made a great deal of sense.
But, what about this? suppose you were to
create a killer title? I am not suggesting your content isn't good.,
but what if you added a post title to possibly get a person's attention?
I mean Válasz a hozzászólásra is kinda vanilla.

You ought to look at Yahoo's front page and note how they create news titles to grab
people to open the links. You might try adding a video or a pic or two to
grab people interested about everything've got to
say. Just my opinion, it might bring your posts
a little livelier.

Great delivery. Sound

Great delivery. Sound arguments. Keep up the great
work.

Undeniably believe that which

Undeniably believe that which you said. Your favorite justification appeared to be on the net 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-effects , people could take a signal.
Will likely be back to get more. Thanks

Hello I am so excited I found

Hello I am so excited I found your blog, I really found
you by error, while I was researching on Askjeeve for something else, Nonetheless I am
here now and would just like to say many thanks for a fantastic post and a all
round interesting blog (I also love the theme/design), I don’t
have time to look over it all at the moment but I
have bookmarked it and also added your RSS feeds, so
when I have time I will be back to read more, Please do keep up the great jo.

First off I would like to say

First off I would like to say wonderful blog!
I had a quick question that I'd like to ask if you don't mind.
I was curious to know how you center yourself and clear your head before writing.
I've had difficulty clearing my mind in getting my thoughts out there.

I do take pleasure in writing but it just seems like the first 10 to 15 minutes
are generally wasted simply just trying to figure out
how to begin. Any recommendations or hints? Thanks!

It's not my first time to go

It's not my first time to go to see this website, i am browsing this web
page dailly and get pleasant facts from here every day.

I believe everything

I believe everything published was actually very reasonable.
But, what about this? what if you added a little
information? I mean, I don't want to tell you how to run your website,
however suppose you added something that grabbed folk's
attention? I mean Válasz a hozzászólásra is kinda plain.
You could look at Yahoo's home page and watch how they create article titles to grab people interested.
You might add a related video or a related picture or two to grab people excited about everything've
written. In my opinion, it could bring your website a little bit more interesting.

I would like to thank you for

I would like to thank you for the efforts you have put in penning this blog.

I am hoping to check out the same high-grade blog posts from
you later on as well. In fact, your creative writing abilities has motivated me to get my very own site now ;)

Great delivery. Solid

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

Everyone loves what you guys

Everyone loves what you guys tend to be up too.
This kind of clever work and reporting! Keep up the very good works guys I've incorporated you guys to my own blogroll.

Hey this is kind of of off

Hey this is kind of of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have to manually code with HTML. I'm starting a blog soon but have no coding know-how so I wanted to get advice from someone with experience. Any help would be enormously appreciated!

Awesome site you have here

Awesome site you have here but I was wondering if you knew of
any user discussion forums that cover the same topics discussed here?
I'd really like to be a part of community where I can get suggestions from other experienced individuals that share the same interest.
If you have any suggestions, please let me know.
Thanks a lot!

What i don't understood is in

What i don't understood is in reality how you're no longer actually much more smartly-favored than you may be now.

You are very intelligent. You recognize thus considerably on the subject of this subject, produced me for my part believe it from
numerous numerous angles. Its like women and men are not involved until it's one thing
to accomplish with Lady gaga! Your individual
stuffs outstanding. At all times handle it up!

Wow, marvelous blog layout!

Wow, marvelous blog layout! How long have you been blogging
for? you make blogging look easy. The overall look of your site is magnificent, as well as the content!

Every weekend i used to pay a

Every weekend i used to pay a quick visit this web site, because
i wish for enjoyment, for the reason that this this website conations
in fact fastidious funny stuff too.

I relish, lead to I

I relish, lead to I discovered exactly what I used to be taking a look for.
You've ended my four day long hunt! God Bless you man.
Have a nice day. Bye

Tremendous things here. I am

Tremendous things here. I am very glad to peer your article.

Thank you so much and I'm taking a look ahead to touch you.
Will you please drop me a mail?

I believe this is one of the

I believe this is one of the so much important info for me.
And i'm glad studying your article. But should remark on few general issues, The site taste
is perfect, the articles is really great : D. Good activity, cheers

Howdy! This blog post

Howdy! This blog post couldn't be written any better!

Going through this article reminds me of my previous roommate!
He always kept preaching about this. I am going to send this
information to him. Pretty sure he's going to have a great
read. I appreciate you for sharing!

I constantly spent my half an

I constantly spent my half an hour to read this website's posts daily along
with a mug of coffee.

bookmarked!!, I like your

bookmarked!!, I like your blog!

box cialis manufacturer

box cialis manufacturer coupon 2020 largely
biological [url=https://getcialistabsfasty.com/]cialis manufacturer coupon 2020[/url] sudden https://getcialistabsfasty.com/

Hello there, just became

Hello there, just became aware of your blog through Google,
and found that it is really informative. I'm going to watch out for brussels.
I'll be grateful if you continue this in future. Lots
of people will be benefited from your writing. Cheers!

Great beat ! I wish to

Great beat ! I wish to apprentice whilst you amend your
site, how could i subscribe for a weblog web site? The account helped me
a applicable deal. I were a little bit familiar of this your broadcast provided vibrant clear idea

What a information of

What a information of un-ambiguity and preserveness of precious experience about unexpected feelings.

It's going to be finish of

It's going to be finish of mine day, but before finish
I am reading this enormous article to improve my experience.

I would like to thank you for

I would like 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 fact, your creative writing abilities has inspired me to
get my very own site now ;)

Greate pieces. Keep posting

Greate pieces. Keep posting such kind of information on your blog.
Im really impressed by your blog.
Hi there, You've done an excellent job. I'll certainly digg
it and personally recommend to my friends.
I am confident they will be benefited from this
web site.

What's up, just wanted to

What's up, just wanted to mention, I liked this
article. It was helpful. Keep on posting!

Excellent web site. Plenty of

Excellent web site. Plenty of helpful info here. I'm sending
it to some friends ans also sharing in delicious. And naturally, thanks on your sweat!

What's up i am kavin, its my

What's up i am kavin, its my first occasion to commenting anyplace, when i read this piece of writing
i thought i could also create comment due to this good
post.

My brother suggested I might

My brother suggested I might like this website. He was entirely right.
This post truly made my day. You can not imagine simply how much time I had spent for this information! Thanks!

Hi to all, the contents

Hi to all, the contents existing at this site
are actually amazing for people knowledge, well, keep
up the good work fellows.

Wow, fantastic blog layout!

Wow, fantastic blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is great, let alone
the content!

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.