Collective\Html\FormBuilder::getIdAttribute PHP Method

getIdAttribute() public method

Get the ID attribute for a field name.
public getIdAttribute ( string $name, array $attributes ) : string
$name string
$attributes array
return string
    public function getIdAttribute($name, $attributes)
    {
        if (array_key_exists('id', $attributes)) {
            return $attributes['id'];
        }
        if (in_array($name, $this->labels)) {
            return $name;
        }
    }

Usage Example

 /**
  * Get the ID attribute for a field name.
  *
  * @param string $name
  * @param array $attributes
  * @return string 
  * @static 
  */
 public static function getIdAttribute($name, $attributes)
 {
     return \Collective\Html\FormBuilder::getIdAttribute($name, $attributes);
 }