Keyword

Placeholder inside extra field

  • Lucas Gomes
  • Lucas Gomes's Avatar Topic Author
  • Offline
  • New Member
More
5 years 3 months ago #170648 by Lucas Gomes
Placeholder inside extra field was created by Lucas Gomes
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
5 years 3 months ago #170659 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on 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
5 years 3 months ago #170666 by Lucas Gomes
Replied by Lucas Gomes on 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
5 years 3 months ago #170673 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on 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
5 years 3 months ago #170700 by Lucas Gomes
Replied by Lucas Gomes on 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.

More
5 years 2 months ago #170741 by JoomlaWorks
Replied by JoomlaWorks on topic Placeholder inside extra field
I've noted down to add this feature in K2 v2.11.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum