public function profileElementForm(Element $element, Omeka_Record_AbstractRecord $record, $options = array())
 {
     $divWrap = isset($options['divWrap']) ? $options['divWrap'] : true;
     $extraFieldCount = isset($options['extraFieldCount']) ? $options['extraFieldCount'] : null;
     $isUserProfilesMultiElement = get_class($element) == 'UserProfilesMultiElement' ? true : false;
     $this->_element = $element;
     $record->loadElementsAndTexts();
     $this->_record = $record;
     // Filter the components of the element form display
     $labelComponent = $this->_getLabelComponent();
     if ($isUserProfilesMultiElement) {
         $inputsComponent = $this->_getMultiComponent();
     } else {
         $inputsComponent = $this->_getInputsComponent($extraFieldCount);
     }
     $descriptionComponent = $this->_getDescriptionComponent();
     $commentComponent = $this->_getCommentComponent();
     if ($isUserProfilesMultiElement) {
         $addInputComponent = '';
     } else {
         $addInputComponent = $this->view->formSubmit('add_element_' . $this->_element['id'], __('Add Input'), array('class' => 'add-element'));
     }
     $components = array('label' => $labelComponent, 'inputs' => $inputsComponent, 'description' => $descriptionComponent, 'comment' => $commentComponent, 'add_input' => $addInputComponent, 'html' => null);
     $elementSetName = $element->getElementSet()->name;
     $recordType = get_class($record);
     $filterName = array('ElementForm', $recordType, $elementSetName, $element->name);
     $components = apply_filters($filterName, $components, array('record' => $record, 'element' => $element, 'options' => $options));
     if ($components['html'] !== null) {
         return strval($components['html']);
     }
     // Compose html for element form
     $html = $divWrap ? '<div class="field" id="element-' . html_escape($element->id) . '">' : '';
     $html .= '<div class="two columns alpha">';
     $html .= $components['label'];
     $html .= $components['add_input'];
     $html .= '</div>';
     $html .= '<div class="inputs five columns omega">';
     $html .= $components['description'];
     $html .= $components['comment'];
     $html .= $components['inputs'];
     $html .= '</div>';
     // Close 'inputs' div
     $html .= $divWrap ? '</div>' : '';
     // Close 'field' div
     return $html;
 }
Exemple #2
0
 public function elementForm(Element $element, Omeka_Record_AbstractRecord $record, $options = array())
 {
     $divWrap = isset($options['divWrap']) ? $options['divWrap'] : true;
     $extraFieldCount = isset($options['extraFieldCount']) ? $options['extraFieldCount'] : null;
     $this->_element = $element;
     // This will load all the Elements available for the record and fatal error
     // if $record does not use the ActsAsElementText mixin.
     $record->loadElementsAndTexts();
     $this->_record = $record;
     // Filter the components of the element form display
     $labelComponent = $this->_getLabelComponent();
     $inputsComponent = $this->_getInputsComponent($extraFieldCount);
     $descriptionComponent = $this->_getDescriptionComponent();
     $commentComponent = $this->_getCommentComponent();
     $addInputComponent = $this->view->formSubmit('add_element_' . $this->_element['id'], __('Add Input'), array('class' => 'add-element'));
     $components = array('label' => $labelComponent, 'inputs' => $inputsComponent, 'description' => $descriptionComponent, 'comment' => $commentComponent, 'add_input' => $addInputComponent, 'html' => null);
     $elementSetName = $element->set_name;
     $recordType = get_class($record);
     $filterName = array('ElementForm', $recordType, $elementSetName, $element->name);
     $components = apply_filters($filterName, $components, array('record' => $record, 'element' => $element, 'options' => $options));
     if ($components['html'] !== null) {
         return strval($components['html']);
     }
     // Compose html for element form
     $html = $divWrap ? '<div class="field" id="element-' . html_escape($element->id) . '">' : '';
     $html .= '<div class="two columns alpha">';
     $html .= $components['label'];
     $html .= $components['add_input'];
     $html .= '</div>';
     // Close div
     $html .= '<div class="inputs five columns omega">';
     $html .= $components['description'];
     $html .= $components['comment'];
     $html .= $components['inputs'];
     $html .= '</div>';
     // Close 'inputs' div
     $html .= $divWrap ? '</div>' : '';
     // Close 'field' div
     return $html;
 }