Hi , i’m wondering how can i delete the button " Add input " but just from one field , i mean not all of them , just the button from “Coverage” or "Title " , this part is on / Collections / Add colecction / ( i know that these fields are common to items and exhibits ) , how can i select wich “button” delete and wich one not to
i was trying to code this part from “Elementform.php” , what i expected is that if the label is Subject i would be able to add an input and if is another one , equal to 0 , from that way i could just add input from subject , but it doesn’t work , how could i make this , is it possible in this code ? $labelComponent = $this->_getLabelComponent();
** if ( $ labelComponent = ‘Subject’){**
** $inputsComponent = $this->_getInputsComponent($extraFieldCount);}**
** else{ $inputsComponent = 0 }**
** $descriptionComponent = $this->_getDescriptionComponent();**
** $commentComponent = $this->getCommentComponent();**
** $addInputComponent = $this->view->formButton('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**
So, to use the filter as I suggested, you’d need to create a plugin. The code shown on that page is just an example and won’t actually do what you’re trying to do here, though.
The plugin you’d create could be just about as simple as that example, though.
The strategy you mentioned in another thread would also work: editing ElementForm.php directly… you just got the details a little bit wrong. You’d want to test against $element->name, not $labelComponent. In general, though, I don’t recommend modifying the core like this as it leads to problems down the line when you want to upgrade but maintain your changes.