Add font awesome to field name

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
christ2000
User
Posts: 519

Add font awesome to field name

Post by christ2000 »

Hello is there any way to add email icon next to my field name email. i try the following but not work

function Language_Load() {
// Example:
$this->setPhrase("Email", "fas fa-envelope-open-text");
// $this->setPhraseClass("fldcaption", "fas fa-envelope-open-text"); //
thanks


arbei
User
Posts: 9396

Post by arbei »

See Migrate to v2019: http://www.hkvstore.com/phpmaker/doc/migrate.htm
Now Font Awesome v4 (not v5) included in AdminLTE 3 is used.


christ2000
User
Posts: 519

Post by christ2000 »

hello, i now how put in menus but i want show before form labels as:

Email(icon): Field input

thanks


arbei
User
Posts: 9396

Post by arbei »

Font Awesome v4 CSS class names are different from v5. See the Font Awesome site for complete information.


mobhar
User
Posts: 11741

Post by mobhar »

You cannot use setPhrase method in order to change/replace the field caption. Use setFieldPhrase method instead, for example, this will replace CustomerID field caption become "Email" that belongs to the orders table in demo project (adjust the table name and field name to yours):

Language()->setFieldPhrase("orders", "CustomerID", "FldCaption", "Email <i class='fa fa-envelope ew-icon'></i>");


christ2000
User
Posts: 519

Post by christ2000 »

Hello, thanks but where put this code? in global code or language_load or row rendered?

i try to put this on language_load:

function Language_Load() {

Language()->setFieldPhrase("employees", "Email", "FldCaption", "Email <i class='fa fa-envelope ew-icon'></i>");

}

and get this error:

Fatal error: Uncaught Error: Call to a member function setFieldPhrase() on null in C:\xampp\htdocs\phpmaker\phpfn15.php:11391 Stack trace: #0 C:\xampp\htdocs\phpmaker\phpfn15.php(11132): PHPMaker2019\project1lastv1\Language->Language_Load() #1 C:\xampp\htdocs\phpmaker\classes\documents_list.php(382): PHPMaker2019\project1lastv1\Language->construct() #2 C:\xampp\htdocs\phpmaker\documentslist.php(20): PHPMaker2019\project1lastv1\documents_list->construct() #3 {main} thrown in C:\xampp\htdocs\phpmaker\phpfn15.php on line 11391


arbei
User
Posts: 9396

Post by arbei »

If you put it in Language_Load(), you need to use $this instead of Language().


christ2000
User
Posts: 519

Post by christ2000 »

put in language_load, no error but nothing change

// Language Load event
function Language_Load() {
// Example:
$this->setFieldPhrase("employees", "Email", "FldCaption", "Email <i class='fa fa-envelope ew-icon'></i>");

}


christ2000
User
Posts: 519

Post by christ2000 »

ok now i try others fields and work, just the email field do not work.


sangnandar
User
Posts: 980

Post by sangnandar »

"Email" is a reserved name, IIRC.
Check your language file, see the actual fieldname written there, is it "Email" ? Or "_Email" ?

You'll find your language file (xml file) inside phplang folder.


christ2000
User
Posts: 519

Post by christ2000 »

Hello, yes you was right, is listed as _Email, thanks for your help. and all too


Post Reply