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

i like it

i like it

Pretty nice post. I just

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

I think this is one of the

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

Right now it looks like

Right now it looks like BlogEngine is the top blogging platform out there right now.
(from what I've read) Is that what you're using on your blog?

hello there and thank you for

hello there and thank you for your information – I've definitely picked
up anything new from right here. I did however expertise several technical issues using this site, since I experienced to reload the
web site a lot of times previous to I could get it to load correctly.
I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances times will often affect your placement in google and could damage your high quality score if advertising and
marketing with Adwords. Anyway I'm adding this RSS to my e-mail and could
look out for a lot more of your respective interesting content.
Make sure you update this again soon.

Highly energetic post, I

Highly energetic post, I enjoyed that bit. Will there be a part 2?

Wow, wonderful blog layout!

Wow, wonderful blog layout! How long have you been blogging for?
you made blogging look easy. The overall look of
your website is fantastic, let alone the content!

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. appreciate it

i like it great work it nice

i like it great work it nice it.

Does your website have a

Does your website have a contact page? I'm having problems locating it but, I'd like to shoot you an email.

I've got some suggestions for your blog you might be interested in hearing.
Either way, great blog and I look forward to seeing it improve over time.

resident

resident [url=https://chloroquinego.com/#]chloroquine online[/url] equal chloroquine for
gbm complete https://chloroquinego.com/

Informative article, just

Informative article, just what I was looking for.

I am genuinely glad to read

I am genuinely glad to read this web site posts which contains lots
of useful facts, thanks for providing these kinds of data.

I read this article

I read this article completely on the topic of the resemblance of most recent and
previous technologies, it's remarkable article.

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.

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!

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

i like it great work it nice

i like it great work it nice it

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

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!

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 ;)

Wonderful, what a webpage it

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

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.

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

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

Hmm it appears like your

Hmm it appears like your website ate my first comment (it was extremely long) so I guess I'll just sum
it up what I submitted and say, I'm thoroughly enjoying your blog.
I too am an aspiring blog writer but I'm still new to everything.
Do you have any tips for newbie blog writers?
I'd certainly appreciate it.

I'm gone to say to my little

I'm gone to say to my little brother, that he should also go to see this blog on regular basis to get updated from most up-to-date news.

We're a group of volunteers

We're a group of volunteers and opening a new scheme in our community.

Your website offered us with valuable info to work on.
You have done a formidable job and our whole community
will be thankful to you.

Every weekend i used to go to

Every weekend i used to go to see this web page, for the reason that i wish for enjoyment, for the reason that this this site
conations really nice funny information too.

i like it great work it nice

i like it great work it nice work by developer end.

Right here is the right web

Right here is the right web site for everyone who hopes to find out about this topic.
You realize so much its almost tough to argue with you (not that I personally would want to…HaHa).
You definitely put a brand new spin on a subject that has been discussed for decades.

Great stuff, just great!

I was pretty pleased to

I was pretty pleased to uncover this great site. I wanted to thank you for ones time for this particularly fantastic
read!! I definitely really liked every bit of it and I have you
bookmarked to check out new things on your website.

Fine way of explaining, and

Fine way of explaining, and fastidious post to get
facts on the topic of my presentation focus, which i am going to present in institution of
higher education.

My family always say that I

My family always say that I am wasting my time
here at net, however I know I am getting familiarity all the time by reading thes nice articles or reviews.

I have read so many posts

I have read so many posts concerning the blogger lovers however this article is genuinely a pleasant piece
of writing, keep it up.

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.