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

Thank you a bunch for sharing

Thank you a bunch for sharing this with all of us you really recognise what
you're talking about! Bookmarked. Please also consult
with my web site =). We will have a link exchange contract among us

It's an remarkable article

It's an remarkable article for all the internet users; they will take advantage from it
I am sure.

Hi there just wanted to give

Hi there just wanted to give you a quick heads up and let you know
a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue.
I've tried it in two different internet browsers and
both show the same outcome.

What's up every one, here

What's up every one, here every one is sharing such knowledge,
thus it's good to read this weblog, and I used to pay a quick visit this blog everyday.

What's Going down i'm new to

What's Going down i'm new to this, I stumbled upon this I have found It positively helpful
and it has helped me out loads. I'm hoping to contribute & help different customers like its helped
me. Great job.

We're a group of volunteers

We're a group of volunteers and opening
a brand new scheme in our community. Your website provided us with useful info to work on. You have performed an impressive activity and our whole group will probably
be thankful to you.

Excellent post. Keep writing

Excellent post. Keep writing such kind of info on your page.

Im really impressed by your blog.
Hello there, You've performed a great job. I'll certainly digg it and for my part recommend to my friends.
I am sure they'll be benefited from this site.

i like it

i like it

Terrific work! That is the

Terrific work! That is the type of info that are meant to be shared across the
internet. Shame on the seek engines for no longer positioning
this post upper! Come on over and consult with my web site .
Thanks =)

Incredible points. Solid

Incredible points. Solid arguments. Keep up the good spirit.

Very quickly this site will

Very quickly this site will be famous amid all blogging and site-building visitors, due to
it's nice content

If you are going for best

If you are going for best contents like I do, only go to see this web page everyday
as it gives quality contents, thanks

I do not know if it's just me

I do not know if it's just me or if perhaps everyone else experiencing issues with your website.
It looks like some of the written text on your content are running off the screen. Can someone
else please provide feedback and let me know if this is happening to
them as well? This might be a problem with my browser
because I've had this happen previously. Kudos

As the admin of this site is

As the admin of this site is working, no question very soon it will be well-known, due
to its feature contents.

What's up, everything is

What's up, everything is going perfectly here and ofcourse every
one is sharing facts, that's really good, keep up writing.

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 like the helpful info you

I like the helpful info you provide in your articles.
I will bookmark your weblog and check again here regularly.

I am quite certain I'll learn a lot of new stuff right here!
Best of luck for the next!

I do not even know how I

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

cialis 20 mg tablet

cialis 20 mg tablet https://cialisle.com/

I loved as much as you will

I loved as much as you will receive carried
out right here. The sketch is tasteful, your authored material stylish.

nonetheless, you command get bought an edginess over that you wish be delivering the following.
unwell unquestionably come further formerly again since exactly the
same nearly very often inside case you shield this increase.

I believe what you posted

I believe what you posted made a lot of sense.
However, think about this, what if you added a little information? I
am not suggesting your information is not good, however what
if you added something that grabbed people's attention? I mean Válasz a hozzászólásra is kinda vanilla.
You could look at Yahoo's home page and note how they create article headlines to grab viewers to click.
You might try adding a video or a picture or two to get readers excited about
everything've got to say. In my opinion, it could bring your blog a little livelier.

Excellent, what a weblog it

Excellent, what a weblog it is! This web site gives helpful data to us,
keep it up.

Appreciating the commitment

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

Nice blog here! Also your

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

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 pleasant for me to
come here and visit more often. Did you hire out a developer to
create your theme? Outstanding work!

I've been browsing online

I've been browsing online more than 2 hours today, yet I never
found any interesting article like yours. It is pretty
worth enough for me. In my view, if all website owners
and bloggers made good content as you did, the web will be much more useful than ever before.

I am genuinely delighted to

I am genuinely delighted to glance at this
website posts which consists of lots of valuable information, thanks for providing such data.

Greetings I am so grateful I

Greetings I am so grateful I found your blog page, I really found you by accident,
while I was browsing on Digg for something else, Anyways I am
here now and would just like to say many thanks
for a remarkable post and a all round exciting blog (I also love the theme/design), I don’t have time to look over it all at the minute but
I have bookmarked 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 superb jo.

Asking questions are truly

Asking questions are truly nice thing if you are not understanding anything
entirely, except this article gives fastidious understanding even.

Hmm is anyone else having

Hmm is anyone else having 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 feedback would be greatly appreciated.

Hello just wanted to give you

Hello just wanted to give you a brief heads up and let you know a
few of the images aren't loading properly. I'm not sure why but I
think its a linking issue. I've tried it in two different web
browsers and both show the same results.

먹튀사이트, 먹튀검증 먹튀사이트

먹튀사이트, 먹튀검증 먹튀사이트 슈어맨입니다.
슈어맨은 신규는 물론 오픈된 먹튀사이트를 철저히 먹튀검증하여 먹튀없는 시대를 만들어가고 있습니다.
먹튀폴리스를 사랑하는 여러분의 많은 호응바랍니다.
여러분의 충실한 검증사이트가 되도록 노력하겠습니다.

Howdy! This is my first visit

Howdy! This is my first visit to your blog!
We are a collection of volunteers and starting a new project
in a community in the same niche. Your blog provided us beneficial information to work on. You have done a wonderful
job!

Hi, its pleasant piece of

Hi, its pleasant piece of writing on the topic of media print,
we all be aware of media is a great source of data.

Piece of writing writing is

Piece of writing writing is also a excitement, if you be familiar with then you can write otherwise it
is difficult to write.

I think that is one of the so

I think that is one of the so much vital information for me.
And i am happy reading your article. But wanna commentary on few normal issues,
The website taste is perfect, the articles is in reality nice : D.
Just right activity, cheers

Howdy! I know this is kinda

Howdy! I know this is kinda off topic but I was wondering which blog platform are you using for this website?
I'm getting fed up of Wordpress because I've had problems with hackers and
I'm looking at options for another platform. I would be great
if you could point me in the direction of a good platform.

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

What's Happening i'm new to

What's Happening i'm new to this, I stumbled upon this
I've discovered It absolutely useful and it
has aided me out loads. I hope to contribute & help different
users like its helped me. Good job.

My spouse and I absolutely

My spouse and I absolutely love your blog and find nearly all of your post's to be exactly I'm looking for.
can you offer guest writers to write content for yourself? I wouldn't mind creating a post
or elaborating on a number of the subjects you write related to here.
Again, awesome website!

Pretty! This was an

Pretty! This was an incredibly wonderful post. Thanks for supplying this information.

https://www.pinterest.com/pin

https://www.pinterest.com/pin/650348002430891105/
https://www.pinterest.fr/pin/650348002430891105/
https://www.pinterest.de/pin/650348002430891105/
https://www.pinterest.co.uk/pin/650348002430891105/
https://www.pinterest.ca/pin/650348002430891105/
https://www.pinterest.jp/pin/650348002430891105/
https://www.pinterest.it/pin/650348002430891105/
https://www.pinterest.co.kr/pin/650348002430891105/
https://www.pinterest.ru/pin/650348002430891105/
https://www.pinterest.com.au/pin/650348002430891105/
https://www.pinterest.nz/pin/650348002430891105/
https://www.pinterest.es/pin/650348002430891105/
https://www.pinterest.dk/pin/650348002430891105/
https://www.pinterest.pt/pin/650348002430891105/
https://www.pinterest.ie/pin/650348002430891105/
https://www.pinterest.com.mx/pin/650348002430891105/
https://www.pinterest.cl/pin/650348002430891105/
https://www.pinterest.at/pin/650348002430891105/
https://www.pinterest.ch/pin/650348002430891105/
https://www.pinterest.ph/pin/650348002430891105/
https://www.pinterst.com/pin/650348002430891105/
https://www.pinterest.th/pin/650348002430891105/
https://www.pinterest.com.pt/pin/650348002430891105/
https://www.pinterest.com.uy/pin/650348002430891105/
https://www.pinterest.co/pin/650348002430891105/
https://www.pinterest.nl/pin/650348002430891105/
https://www.pinterest.info/pin/650348002430891105/
https://www.pinterest.kr/pin/650348002430891105/
https://www.pinterest.vn/pin/650348002430891105/
https://www.pinterest.com.vn/pin/650348002430891105/
https://www.pinterest.biz/pin/650348002430891105/
https://www.pinterest.ec/pin/650348002430891105/
https://www.pinterest.mx/pin/650348002430891105/
https://www.pinterest.in/pin/650348002430891105/
https://www.pinterest.pe/pin/650348002430891105/
https://www.pinterest.co.at/pin/650348002430891105/
https://www.pinterest.hu/pin/650348002430891105/
https://www.pinterest.co.in/pin/650348002430891105/
https://www.pinterest.co.nz/pin/650348002430891105/
https://www.pinterest.id/pin/650348002430891105/
https://www.pinterest.co.id/pin/650348002430891105/
https://www.pinterest.com.ec/pin/650348002430891105/
https://www.pinterest.com.py/pin/650348002430891105/
https://www.pinterest.tw/pin/650348002430891105/
https://www.pinterest.be/pin/650348002430891105/
https://www.pinterest.uk/pin/650348002430891105/
https://www.pinterest.com.bo/pin/650348002430891105/
https://www.pinterest.com.pe/pin/650348002430891105/

My brother suggested I might

My brother suggested I might like this web site.
He was totally right. This post actually made my day.

You cann't imagine just how much time I had spent
for this information! Thanks!

These are truly wonderful

These are truly wonderful ideas in about blogging.

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

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.