Expression Engine: adding placeholder to text fields

Wednesday, December 28, 2011@ 1:37 AM
Author: Mark Middleton

Safecracker has been a huge leap forward in managing front-end “stand alone entry forms” (SAEFs).   One feature I was looking for is to simply add the attribute “placeholder” in each of the standard text input fields.

With a simple tweak to the text fieldtype file, this was an easy add: (EE version 2.3.1)

  • In /(your system folder)/expressionengine/fieldtypes/text/ft.text.php
  • Make the following modification:

Before Modification:
function display_field($data)
{
$type = (isset($this->settings['field_content_type'])) ? $this->settings['field_content_type'] : 'all';

$data = $this->_format_number($data, $type);

return form_input(array(
'name' => $this->field_name,
'id' => $this->field_name,
'value' => $data,
'dir' => $this->settings['field_text_direction'],
'maxlength' => $this->settings['field_maxl'],
'field_content_type' => $type
));
}

After Modification
function display_field($data)
{
$type = (isset($this->settings['field_content_type'])) ? $this->settings['field_content_type'] : 'all';

$data = $this->_format_number($data, $type);

return form_input(array(
'name' => $this->field_name,
'id' => $this->field_name,
'value' => $data,
'dir' => $this->settings['field_text_direction'],
'maxlength' => $this->settings['field_maxl'],
'placeholder' => $this->settings['field_label'], // this line added to show placeholder text
'field_content_type' => $type
));
}

PROS:

  • simple fix
  • places placeholder text in all text fields added by safecracker

CONS:

  • places placeholder text in ALL text fields (no function to only display if desired, etc…)

Roots and Wings (T-Minus 5 Days)

Monday, January 10, 2011@ 1:29 PM
Author: Mark Middleton

Today is Monday, and this week is busy!

image courtesy JM Scott - http://cargocollective.com/jmscott

This coming Saturday, Nick, Isabelle Pug, and I are leaving for Rome, Italy for a 3 month temporary office relocation.   We sublet our place in Hollywood, CA and have rented a one bedroom apartment on the 4th floor of a building 2 blocks from the Vatican.  The Rome apartment has high speed internet and balcony with views over the busy street and the Dome of St. Peter’s over the rooftops.

Preparations are in full swing.  Isabelle has been vaccinated and a host of paperwork completed to ensure a speedy entrance to the EU.  She is having an International Microchip placed under her skin – as the US uses a system that is different from the rest of the world (say it isn’t so…).  My lost passport has been replaced (I pick it up tomorrow morning from the Federal Building on Wilshire near the 405), and Nick is having a loose filling in his tooth fixed this morning.  We have our confirmation on the apartment in Rome, and a deposit received from my lovely tenant in LA.  I’ll be storing my truck at Dudley’s, and all personal items we’re not bringing with us are going into Nick’s closet.

The last time I was in the Eternal City was in November of 2002 with my mom, her ex-husband and my (now estranged) ex-best friend, Mike.  We were there to celebrate my mom’s 50th birthday with a 10 day “highlights of Italy tour”.  It was here where I had a very key moment of revelation that helped me through some very deeply embedded walls in my life.  A few minutes at the top spire of St. Peter’s looking out over Rome helped me ask some very challenging questions of myself, God and my relationships.

“Let a man so account of us, as of the ministers of Christ, and stewards of the mysteries of God.”
1 Cor 4:1 KJV

By 2002, I had put myself through 7 years of regimented reparative therapy to cure the Gay in me.  Frequent counseling with Exodus International, accountability sessions with hetero couples, dating some fantastic women, 40 day “juice fasts” were performed each year during lent were just a few of the self-imposed disciplines I engaged in.  I fully believed that if I surrendered to God enough, he would fix what was broken.  But, as God would have it, He helped me discover what was broken and what wasn’t – and helped me start the process of unraveling the mystery.  We’ll be exploring this in more detail in the next 3 months.

For the first time in many years, I feel like I have both roots and wings.  The roots of my faith, my love of family and friends, and the seeds of appreciation for myself and what I have to offer to this world.  I fly on the wings of freedom from judgement, a passion for people and a hope for humanity as we continue to evolve through these most interesting times.