private static function set_extra_property(array $property, $data) { self::$extra = ''; $data_exists = false; if ($data && $data != $property['value']) { $property['value'] = $data; $data_exists = true; } /* * Ignore the textarea, editor */ $value_skip = array('editor', 'textarea'); foreach ($property as $key => $value) { if (!in_array($key, self::$enable_property) || $key == 'value' && in_array($property['type'], $value_skip)) { continue; } if ($key == 'value' && !$data_exists) { $other = sprintf(' placeholder="%s" ', $value, $value, $value); self::$extra .= $other; } else { self::$extra .= sprintf(' %s="%s" %s', $key, $value, $other); } } if (!isset($property['require']) || $property['require']) { self::$extra .= 'required="true"'; } }