Keyword

Placeholder inside extra field

  • Lucas Gomes
  • Lucas Gomes's Avatar Topic Author
  • Offline
  • New Member
More
1 month 2 days ago #170648 by Lucas Gomes
Lucas Gomes created the topic: Placeholder inside extra field
Hi,

I've been using K2 Version 2.9.0. I would like to insert a placeholder on Extra Field.

I thinks the file is in the path: components> com_k2>models> extrafield.php

Someone could help me?

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
1 month 18 hours ago #170659 by Mohamed Abdelaziz
Mohamed Abdelaziz replied the topic: Placeholder inside extra field
Hi Lucas

Can you give an example for what you want to achieve?

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

Please Log in or Create an account to join the conversation.

  • Lucas Gomes
  • Lucas Gomes's Avatar Topic Author
  • Offline
  • New Member
More
4 weeks 2 days ago #170666 by Lucas Gomes
Lucas Gomes replied the topic: Placeholder inside extra field
Hi, I can do it!

Look the image! I would like to insert all labels inside the text area. For example as the image, "Unidade Tematica".

Did you understand? =D
Attachments:

Please Log in or Create an account to join the conversation.

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
4 weeks 1 day ago #170673 by Mohamed Abdelaziz
Mohamed Abdelaziz replied the topic: Placeholder inside extra field
Hi Lucas,
The file path is administrator>components> com_k2>models> extrafield.php

For the text area field type, find this line:
$output = '<textarea name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" rows="'.$active[2].'" cols="'.$active[3].'" '.$attributes.'>'.htmlspecialchars($active[0], ENT_QUOTES, 'UTF-8').'</textarea>';

Insert this line BEFORE it:
$attributes .= ' placeholder="'. $extraField->name .'"';

So the final code will be like this:
$attributes .= ' placeholder="'. $extraField->name .'"';
$output = '<textarea name="K2ExtraField_'.$extraField->id.'" id="K2ExtraField_'.$extraField->id.'" rows="'.$active[2].'" cols="'.$active[3].'" '.$attributes.'>'.htmlspecialchars($active[0], ENT_QUOTES, 'UTF-8').'</textarea>';

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

Please Log in or Create an account to join the conversation.

  • Lucas Gomes
  • Lucas Gomes's Avatar Topic Author
  • Offline
  • New Member
More
3 weeks 6 days ago #170700 by Lucas Gomes
Lucas Gomes replied the topic: Placeholder inside extra field
Omg, This worked here, Thanks, You helped me a lot. =D

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 3 days ago #170741 by Fotis
Fotis replied the topic: Placeholder inside extra field
I've noted down to add this feature in K2 v2.11.


If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

Moderators: william white