Starts the rule builder with an
input target

@param string $input
@param string|null $attribute
@return Rule
176593
public function add($input, $attribute = null)
    {
        $this->input = $input;
        static::$rules[$input] = [];

        if (isset($attribute)) {
            static::$attributes[$input] = $attribute;
        }

        return $this;
    }
1164707
public function textField($model, $attribute, $htmlOptions = array())
    {
        return $this->createInput(TbHtml::INPUT_TYPE_TEXT, $model, $attribute, $htmlOptions);
    }
508371
public function setTableAttribute($attribute, $value = null)
    {
        if (is_array($attribute)) {
            return $this->setTableAttributes($attribute);
        }

        $this->tableAttributes[$attribute] = $value;

        return $this;
    }
1128806
public function setRules($input)
	{
		if ($input instanceof \Hubzero\Access\Rules)
		{
			$this->_rules = $input;
		}
		else
		{
			$this->_rules = new \Hubzero\Access\Rules($input);
		}
	}
312590
public function setAttribute($attribute)
    {
        if (strpos($attribute, '.') !== false) {
            $pieces = explode('.', $attribute, 2);
            $this->setAlias($pieces[0]);
            $attribute = $pieces[1];
        // If an alias was already set then this must be set back to null.
        } else {
            $this->alias = null;
        }
        $this->attribute = $attribute;
    }
412389
protected function replaceBefore($message, $attribute, $rule, $parameters)
    {
        if (! strtotime($parameters[0])) {
            return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message);
        }

        return str_replace(':date', $this->getDisplayableValue($attribute, $parameters[0]), $message);
    }
387932
public function allowAttribute($attribute)
    {
        if (is_array($attribute))
        {
            foreach ($attribute as $attrib)
                $this->allowed_attributes[$attrib] = true;
        }
        else
            $this->allowed_attributes[$attribute] = true;
        return $this;
    }
1251486
public function input($field, $value = null, array $attributes = array())
	{
		if (is_array($field))
		{
			$attributes = $field;
			! array_key_exists('value', $attributes) and $attributes['value'] = '';
		}
		else
		{
			$attributes['name'] = (string) $field;
			$attributes['value'] = (string) $value;
		}

		$attributes['type'] = empty($attributes['type']) ? 'text' : $attributes['type'];

		if ( ! in_array($attributes['type'], static::$_valid_inputs))
		{
			throw new \InvalidArgumentException(sprintf('"%s" is not a valid input type.', $attributes['type']));
		}

		if ($this->get_config('prep_value', true) && empty($attributes['dont_prep']))
		{
			$attributes['value'] = $this->prep_value($attributes['value']);
		}
		unset($attributes['dont_prep']);

		if (empty($attributes['id']) && $this->get_config('auto_id', false) == true)
		{
			$attributes['id'] = $this->get_config('auto_id_prefix', 'form_').$attributes['name'];
		}

		$tag = ! empty($attributes['tag']) ? $attributes['tag'] : 'input';
		unset($attributes['tag']);

		return html_tag($tag, $this->attr_to_string($attributes));
	}
877664
public function set_attr( $attribute, $value = null ) {
		if ( is_null( $value ) || $value === false ) {
			if ( array_key_exists( $attribute, $this->attr ) ) {
				unset( $this->attr[$attribute] );
			}
		} else {
			if ( $value === true ) {
				$value = $attribute;
			}
			$this->attr[ $attribute ] = $value;
		}
		
		return $this;
	}
1328580
protected function translator( $key, $rule, $attribute, array $parameters )
	{
		$strings = [];//glsr_resolve( 'Strings' )->validation();

		$message = isset( $strings[$key] )
			? $strings[$key]
			: false;

		if( !$message )return;

		$message = str_replace( ':attribute', $attribute, $message );

		if( method_exists( $this, $replacer = "replace{$rule}" )) {
			$message = $this->$replacer( $message, $parameters );
		}

		return $message;
	}
13403
public function set($attribute, $value)
    {
        if ($value === [] || $value === '' || $value === null) {
            return $this->reset($attribute);
        }

        if ($this->has($attribute)) {
            $attribute = $this->resolveAttributeName($attribute);
            $this->attributes[$attribute] = $value;
        } else {
            $this->attributes[$attribute] = $value;
        }
        $this->batches->add(new Batch(Batch::TYPE['REPLACE'], $attribute, $value));

        return $this;
    }
271690
public function searchQuery($model, $attribute, $htmlOptions = array())
    {
        return $this->createInput(TbHtml::INPUT_TYPE_SEARCH, $model, $attribute, $htmlOptions);
    }
302773
public function create($input)
	{
		$mapper = $this->getMapper();
		$admin  = $mapper->getAdmin();

		$model      = $this->getModel();
		$primaryKey = (new $model)->getKeyName();

		$this->setInput($input);

		// Field pre update
		foreach ($mapper->getFields() as $field) {
			$field->preUpdate();
			$input = $this->getInput();

			// Is this a multiple field?
			if ($field->isMultiple()) {
				$value = Value::encode(Config::get('bauhaus::admin.multiple-serializer'), $input[$field->getName()]);
				$this->setInputVariable($field->getName(), $value);
			}

			if ($field->hasSaving()) {
				$saving = $field->getSaving();
				$this->setInputVariable($field->getName(), $saving($input[$field->getName()]));
			}
		}

		// Model before create hook
		if (method_exists($admin, 'beforeCreate')) {
			$admin->beforeCreate($input);
		}

		// Validate
		if (property_exists($model, 'rules')) {
			$validator = Validator::make($this->getInput(), $model::$rules);
			if ($validator->fails()) {
				return $validator;
			}
		}

		// Model create hook
		if (method_exists($admin, 'create')) {
			$model = $admin->create($this->getInput());
		} else {
			$model = $model::create($this->getInput());
		}

		// Set the primary id from the `new` model
		$this->setIdentifier($model->{$primaryKey});

		// Field post update
		foreach ($mapper->getFields() as $field) {
			$field->postUpdate($this->getInput());
		}

		// Model after create hook
		if (method_exists($admin, 'afterCreate')) {
			$result = $admin->afterCreate($this->getInput());

			if ($result instanceof \Illuminate\Http\RedirectResponse) {
				$result->send();
			}
		}

		return $this;
	}
960595
public static function activeCheckBox($model, $attribute, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        $input = parent::activeCheckBox($model, $attribute, $htmlOptions);
        if (TbArray::popValue('useContainer', $htmlOptions, false)) {
            return self::tag(
                'div',
                array('class' => 'checkbox'),
                self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions)
            );
        } else {
            return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
        }
    }
799673
public function checkBox($model, $attribute, $htmlOptions = array())
    {
        return $this->createInput(TbHtml::INPUT_TYPE_CHECKBOX, $model, $attribute, $htmlOptions);
    }
1226771
protected function arrayToConditionDataModel(array $input)
    {
        /** @var \Smile\ElasticsuiteCatalogRule\Model\Data\Condition $conditionDataModel */
        $conditionDataModel = $this->conditionDataFactory->create();
        foreach ($input as $key => $value) {
            switch ($key) {
                case 'type':
                    $conditionDataModel->setConditionType($value);
                    break;
                case 'attribute':
                    $conditionDataModel->setAttributeName($value);
                    break;
                case 'operator':
                    $conditionDataModel->setOperator($value);
                    break;
                case 'value':
                    $conditionDataModel->setValue($value);
                    break;
                case 'aggregator':
                    $conditionDataModel->setAggregatorType($value);
                    break;
                case 'conditions':
                    $conditions = [];
                    foreach ($value as $condition) {
                        $conditions[] = $this->arrayToConditionDataModel($condition);
                    }
                    $conditionDataModel->setConditions($conditions);
                    break;
                default:
            }
        }

        return $conditionDataModel;
    }
139214
protected function convertRule($rule, $attribute, $type)
	{
		$parsedRule = $this->parseValidationRule($rule);
		$jqueryAttrs = [];
		$ruleMethodName = $this->getRuleMethodName($parsedRule['name']);

		// if method not exists that means it is not implemented yet so return empty array
		if(!method_exists($this, $ruleMethodName))
		{
			return $jqueryAttrs;
		}

		$jqueryAttrs = $this->$ruleMethodName($parsedRule, $attribute, $type);
		
		// if validation messages of laravel is going to be used, convert them too
		if(\Config::get('laravel-to-jquery-validation::useLaravelMessages'))
		{
			$messageMethodName = $this->getMessageMethodName($parsedRule['name']);
			
			// if method not exists, get error message by using default way
			if(!method_exists($this, $messageMethodName))
			{
				$jqueryAttrs = $jqueryAttrs + $this->getErrorMessage($parsedRule['name'], $attribute);
			}
			else
			{
				$jqueryAttrs = $jqueryAttrs + $this->$messageMethodName($parsedRule, $attribute, $type);
			}
		}

		return $jqueryAttrs;
	}