Capx 88 | Required fields on mapper form

# Ready for review

* Adds required field validation to mappers
* Fixes a couple of bugs

Simply adding required to the form elements that are required causes errors in the form submission as it processes all fields as required when we only want a portion of the form. This is a problem with the way the form is generated to begin with but it is easier to work around it. Validation for required fields has to be on the validation hook. This is not a problem. The mapper form uses a theme_wrapper that replaces a field's label with the required asterix (*) with a preg_replace. This is kind of yucky and am open to suggestions on a better fix.
Function t() includes check_plain() call AND saves this string for
translation, which is overhead in this case. In general any variable should
not be passed to t(), it should go to check_plain().

2014-10-28 20:14 GMT+03:00 Sherakama <notifications@github.com>:

> In stanford_capx.forms.inc:
>
> > @@ -366,13 +366,25 @@ function stanford_capx_mapper_form_get_field_mapping_form($form, &$form_state) {
> >      foreach ($properties as $property_machine_name => $prop_info) {
> >
> >        $form['field-mapping'][$property_container][$property_machine_name] = array(
> > -          '#type' => 'textfield',
> > -          '#title' => t($prop_info['label']),
> > -          '#description' => t($prop_info['description']),
> > -          '#default_value' => isset($mapper->properties[$property_machine_name]) ? $mapper->properties[$property_machine_name] : '',
> > -          '#theme_wrappers' => array('stanford_capx_columns_to_the_right'),
> > -          '#field_info' => $prop_info,
> > +        '#type' => 'container',
> > +        '#title' => t($prop_info['label']),
>
> Not sure why this needs a check_plain() as the information comes from
> entity_get_property_info()
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/SU-SWS/stanford_capx/pull/18/files#r19486757>.
>



-- 
С уважением Кирилл Росколий.
-----------------------------------------------
Мобильный: +380501919021
Skype: roskoliy.kirill
WWW: http://kroskoliy.com/