Convenience function: Adds an response editor

@param int $count The count of the element to add
@param string $label, null means default
@param bool $required
@return void
500858
protected final function add_response($count, $label = null, $required = false) {
        if ($label === null) {
            $label = get_string('response', 'lesson');
        }
        $this->_form->addElement('editor', 'response_editor['.$count.']', $label,
                 array('rows' => '4', 'columns' => '80'),
                 array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
        $this->_form->setType('response_editor['.$count.']', PARAM_RAW);
        $this->_form->setDefault('response_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));

        if ($required) {
            $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
        }
    }
1367452
public function responseIsSuccessfullyWithContainListResult(TableNode $table, $count = null)
    {
        $this->responseIsSuccessfully();

        $rpcResult = $this->response->getRpcResult();

        Assertions::assertTrue(is_array($rpcResult), sprintf(
            'The RPC response must be a array, but "%s" given.',
            gettype($rpcResult)
        ));

        if ($count !== null) {
            Assertions::assertCount((int) $count, $rpcResult, sprintf(
                'The response should have %d elements, but %d given.',
                $count,
                count($rpcResult)
            ));
        }

        foreach($table->getHash() as $key => $row) {
            if (isset($row['__key__'])) {
                $key = $row['__key__'];
                unset ($row['__key__']);
            }

            Assertions::assertArrayHasKey($key, $rpcResult, sprintf(
                'Not found data with key "%s" in array (%s).',
                $key,
                json_encode($rpcResult)
            ));

            $this->assertArrayEquals($rpcResult[$key], $row);
        }
    }
853928
public function postDelete(Event $event, $id, $count) {
        if (!$this->getConfig('onDelete') || !$this->_deleteIndex) {
            return;
        }

        $this->_removeNode($id, $this->_deleteIndex);
        $this->_deleteIndex = null;
    }
934403
public function &addControl($control, $name='', $label = '', $value = '', $description = '', $unbound = false)
    {
        $string = new CamelCase($control);

        $control = $this->factory->create('FormDesigner\Controls\\' . $string->camelize() . 'Control');

        // Set name
        $control->setName($name);

        // set contols name
        if ($unbound && method_exists($control, 'setUnbound')) {
            $control->setUnbound();
            $control->removename();
        }

        // Label set?
        if (! empty($label) && method_exists($control, 'setLabel')) {
            $control->setLabel($label);
        }

        if (! empty($value) && method_exists($control, 'setValue')) {
            $control->setValue($value);
        }

        if (! empty($description) && method_exists($control, 'setDescription')) {
            $control->setDescription($description);
        }

        if ($control instanceof Button) {
            $control->noLabel();
        }

        // Create element
        $this->elementFactory('control', $control);

        return $control;
    }
573010
synchronized public void addLabel(String label) {
        if (!labelMap.contains(label)) {
            labelMap.add(labelCounter++, label);
        }
    }
136003
public function count($count, $error) {
        if ($this->_exist) {
            array_push($this->_constraints, ['type' => self::COUNT, 'value' => $count, 'message' => $error]);
        }

        return $this;
    }
380929
public function addTextarea($name, $label = '', $is_mandatory = true )
    {
        $e = new \FrenchFrogs\Form\Element\Textarea($name, $label);
        $this->addElement($e);

        if ($is_mandatory) {
            $e->addRule('required');
        } else {
            $e->addFilter('nullable');
        }

        return $e;
    }
384371
public function addTab( $label, $content, $fragmentKey = NULL )
	{
		if( is_null( $fragmentKey ) )
		{
			$this->tabs[]	= $label;
			$this->divs[]	= $content;
		}
		else
		{
			if( isset( $this->tabs[$fragmentKey] ) )
				throw new Exception( 'Tab with Fragment ID "'.$fragmentKey.'" is already set' );
			$this->tabs[$fragmentKey]	= $label;
			$this->divs[$fragmentKey]	= $content;
		}
	}
747430
public function createEmailElement($name, $label, $required = false, $multi = false) {
        $options['label']     = $label;
        $options['maxlength'] = 250;
        $options['required']  = $required;
        $options['size']      = 50;

        $element = $this->_form->createElement('text', $name, $options);

        if ($multi) {
            $element->addValidator('SimpleEmails');
        } else {
            $element->addValidator('SimpleEmail');
        }

        return $element;
    }
667600
public function addLabelForMenuItem(string $label, string $do = P_DO, string $p = P)
    {
        $this->menu_labels[$p][$do] = $label;

        return $this;
    }
961913
public function addLabel(Doozr_Form_Service_Component_Interface_Html $label)
    {
        $index               = $this->addChild($label);
        $this->index[$index] = self::LABEL;

        (!isset($this->indexReverse[self::LABEL])) ? $this->indexReverse[self::LABEL] = [] : null;
        $this->indexReverse[self::LABEL][]                                            = $index;

        return $index;
    }
584154
public function addLabel($label, $before=false, $icon=NULL) {
		$labelO=$label;
		if (\is_object($label) === false) {
			$labelO=new HtmlLabel("label-" . $this->identifier, $label);
			if (isset($icon))
				$labelO->addIcon($icon);
		} else {
			$labelO->addToPropertyCtrl("class", "label", array ("label" ));
		}
		$this->addContent($labelO, $before);
		return $labelO;
	}
1325934
public function fail($label, $computed, $test, $expected) {
    if ($this->output && !$this->output->isQuiet()) {
      $this->output->write("<fg=red>F</fg=red>");
    }
    $this->failed += 1;
    
    $this->failures[] = array(
      'label'    => $label,
      'computed' => $computed,
      'test'     => $test,
      'expected' => $expected
    );
  }
117135
private function handle(Response $response, $count = false)
    {
        $responseData = json_decode($response->getContent(), true);

        if (!$response->isSuccessful()) {
            // @todo get better error
            throw new \RuntimeException($response->getContent());
        }

        if (true === $count) {
            switch ($responseData['kind']) {
                case 'youtube#playlistItemListResponse':
                    return (int) $responseData['pageInfo']['totalResults'];
                    break;

                default:
                    throw new \Exception('unsupported count operation');
                    break;
            }
        }

        if (isset($responseData['nextPageToken'])) {
            $this->nextPageToken = $responseData['nextPageToken'];
        } else {
            $this->nextPageToken = null;
        }
        return $responseData['items'];
    }
1058650
public function addFields($fields=NULL, $label=NULL) {
		if (isset($fields)) {
			if (!$fields instanceof HtmlFormFields) {
				if (!\is_array($fields)) {
					$fields=\func_get_args();
					$end=\end($fields);
					if (\is_string($end)) {
						$label=$end;
						\array_pop($fields);
					} else
						$label=NULL;
				}
				$this->_fields=\array_merge($this->_fields, $fields);
				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
			}
			if (isset($label)){
				$fields->wrap("<div class='field'><label>{$label}</label>","</div>");
			}
		} else {
			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
		}
		$this->addItem($fields);
		return $fields;
	}
778139
public function addFile($name, $label = '', $is_mandatory = true)
    {
        $e = new \FrenchFrogs\Form\Element\File($name, $label);
        $this->addElement($e);

        if ($is_mandatory) {
            $e->addRule('required');
        } else {
            $e->addFilter('nullable');
        }

        return $e;
    }
8683
protected function validatePrompt($field, $label, $validator, $default = null)
    {
        $input = $this->prompt($label, $default);

        if (!$this->isValidInput($input, $field, $validator)) {
            $this->errors();
            $this->validatePrompt($field, $label, $validator, $default);
        }
    }