/** * Uppercases the first character of a multibyte string. * * @param string $string The multibyte string. * * @return string The string with the first character converted to upercase. */ public function ucfirstFilter($string) { return StringHelper::uppercaseFirst($string); }
/** * @inheritDoc BaseModel::defineAttributes() * * @return array */ protected function defineAttributes() { $requiredTitle = isset($this->_requiredFields) && in_array('title', $this->_requiredFields); $attributes = array('id' => AttributeType::Number, 'elementId' => AttributeType::Number, 'locale' => array(AttributeType::Locale, 'default' => craft()->i18n->getPrimarySiteLocaleId()), 'title' => array(AttributeType::String, 'required' => $requiredTitle, 'maxLength' => 255, 'label' => 'Title')); foreach (craft()->fields->getAllFields() as $field) { $fieldType = $field->getFieldType(); if ($fieldType) { $attributeConfig = $fieldType->defineContentAttribute(); } // Default to Mixed if (!$fieldType || !$attributeConfig) { $attributeConfig = AttributeType::Mixed; } $attributeConfig = ModelHelper::normalizeAttributeConfig($attributeConfig); $attributeConfig['label'] = $field->name != '__blank__' ? $field->name : StringHelper::uppercaseFirst($field->handle); if (isset($this->_requiredFields) && in_array($field->id, $this->_requiredFields)) { $attributeConfig['required'] = true; } $attributes[$field->handle] = $attributeConfig; } return $attributes; }