Jump to content

Hooks for repeater items


Juergen
 Share

Recommended Posts

I want to use a repeater field to create business hours (opening hours) for a shop.  Each repeater item should be a day (Monday, Tuesday,....) and consist of different input fields (Inputfield time, Inputfield options,...).

In this case the customer should not be able to delete or add a repeater item after I have created 7 repeater items (1 for each day)

Question:

How can I remove the delete or add button via a hook after creating the repeater items, so that the customer is no longer able to add or delete a repeater item?

Here is for example the code for the add link at the bottom:

 
	/**
	 * Render the repeater items
	 *
	 */
	public function ___render() {

		// a hidden checkbox with link that we use to identify when items have been added
		$out = 	"\n<p class='InputfieldRepeaterAddItem'>" . 
			"\n\t<input type='text' name='_{$this->name}_add_items' value='0' />" . 
			"\n\t<a href='#' class='InputfieldRepeaterAddLink'><i class='fa fa-plus-circle'></i> " . $this->_('Add Item') . "</a>" . 
			"\n</p>";

		return $this->buildForm()->render() . $out; 
}

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...