Initialize buttons column.

@param string $field
358488
public function init_button($field)
    {
        $this->on('click', '.do-'.$field)->univ()->ajaxec(array(
            $this->app->url(),
            $field => $a = $this->js()->_selectorThis()->data('id'),
            $this->name.'_'.$field => $a,
            ));

        /*
        $this->columns[$field]['thparam'] .= ' style="width: 40px; text-align: center"';
        $this->js(true)->find('.button_'.$field)->button();
        */
    }
642194
public function setFields($values)
    {
        foreach ($values as $field => $value) {
            $this->setField($field, $value);
        }
    }
25451
public function format_button($field)
    {
        $class = $this->columns[$field]['button_class'];

        $icon = $this->columns[$field]['icon'];
        if ($icon) {
            if ($icon[0] != '<') {
                $icon = '<span class="icon-'.$icon.'"></span>';
            }
            $icon .= '&nbsp;';
        }

        $this->current_row_html[$field] =
            '<button class="atk-button-small do-'.$field.'  '.$class.'" data-id="'.$this->model->id.'">'.
                $icon.$this->columns[$field]['descr'].
            '</button>';
    }
799599
private function fixInputAttributes(&$field)
    {
        if (is_array($field['attributes'])) {
            $field['attributes']['placeholder'] = $field['placeholder'];
        } else {
            $field['attributes'] .= sprintf(' placeholder="%s"', $field['placeholder']);
            $field['attributes'] = trim($field['attributes']);
        }
    }
222095
private function columnLabel($field, $column)
    {
        if (!is_array($field) && !in_array($field, $this->columnTypes)) {
            return ucfirst($field);
        }

        return (isset($field['alt_name'])) ? $field['alt_name'] : ucfirst($column);
    }
665896
protected function updateFormField($field)
    {
        parent::updateFormField($field);

        if ($this->MinValue) {
            $field->setAttribute('data-rule-min', $this->MinValue);
        }

        if ($this->MaxValue) {
            $field->setAttribute('data-rule-max', $this->MaxValue);
        }
    }
1199152
public function set_field($field) {
        global $CFG;
        if ($CFG->debugdeveloper) {
            $properties = ['id', 'shortname', 'name', 'datatype', 'description', 'descriptionformat', 'categoryid', 'sortorder',
                'required', 'locked', 'visible', 'forceunique', 'signup', 'defaultdata', 'defaultdataformat', 'param1', 'param2',
                'param3', 'param4', 'param5'];
            foreach ($properties as $property) {
                if (!property_exists($field, $property)) {
                    debugging('The \'' . $property . '\' property must be set.', DEBUG_DEVELOPER);
                }
            }
        }
        if ($this->fieldid && $this->fieldid != $field->id) {
            throw new coding_exception('Can not set field object after a different field id was set');
        }
        $this->fieldid = $field->id;
        $this->field = $field;
        $this->inputname = 'profile_field_' . $this->field->shortname;
        $this->data = $this->field->defaultdata;
        $this->dataformat = FORMAT_HTML;
    }
510449
protected function initButton()
	{
		if ($this->checkedButtonLabel === null)
			$this->checkedButtonLabel = Yii::t('zii', 'Uncheck');

		if ($this->uncheckedButtonLabel === null)
			$this->uncheckedButtonLabel = Yii::t('zii', 'Check');

		if ($this->emptyButtonLabel === null)
			$this->emptyButtonLabel = Yii::t('zii', 'Not set');

		$this->button = array(
			'url' => 'Yii::app()->controller->createUrl("' . $this->toggleAction . '",array("pk"=>$data->primaryKey,"attribute"=>"' . $this->name . '"))',
			'htmlOptions' => array('class' => $this->name . '_toggle' . $this->uniqueClassSuffix),
		);

		if (Yii::app()->request->enableCsrfValidation) {
			$csrfTokenName = Yii::app()->request->csrfTokenName;
			$csrfToken = Yii::app()->request->csrfToken;
			$csrf = "\n\t\tdata:{ '$csrfTokenName':'$csrfToken' },";
		} else {
			$csrf = '';
		}

		if ($this->afterToggle === null) {
			$this->afterToggle = 'function(){}';
		}

		$this->button['click'] = "js:
function() {
	var th=this;
	var afterToggle={$this->afterToggle};
	$.fn.yiiGridView.update('{$this->grid->id}', {
		type:'POST',
		url:$(this).attr('href'),{$csrf}
		success:function(data) {
			$.fn.yiiGridView.update('{$this->grid->id}');
			afterToggle(true, data);
		},
		error:function(XHR){
			afterToggle(false,XHR);
		}
	});
	return false;
}";
	}
1209125
private void initializeButtons()
	{
		initializeButton(button1 = new Button("1"), Color.black, Color.lightGray);
		initializeButton(button2 = new Button("2"), Color.black, Color.lightGray);
		initializeButton(button3 = new Button("3"), Color.black, Color.lightGray);
		initializeButton(button4 = new Button("4"), Color.black, Color.lightGray);
		initializeButton(button5 = new Button("5"), Color.black, Color.lightGray);
		initializeButton(button6 = new Button("6"), Color.black, Color.lightGray);
		initializeButton(button7 = new Button("7"), Color.black, Color.lightGray);
		initializeButton(button8 = new Button("8"), Color.black, Color.lightGray);
		initializeButton(button9 = new Button("9"), Color.black, Color.lightGray);
		initializeButton(button0 = new Button("0"), Color.black, Color.lightGray);
		initializeButton(buttonCancel = new Button("A"), Color.black, Color.lightGray);
		initializeButton(buttonTable = new Button("T"), Color.black, Color.lightGray);
		initializeButton(buttonEnter = new Button("E"), Color.black, Color.lightGray);
		initializeButton(buttonMinus = new Button("-"), Color.black, Color.lightGray);
		initializeButton(buttonPlus = new Button("+"), Color.black, Color.lightGray);
		initializeButton(buttonStorno = new Button("ST"), Color.black, Color.lightGray);
	}
102138
function create_new_field_keys( &$field )
	{
		// update key
		$field['key'] = 'field_' . uniqid();
		
		
		if( isset($field['sub_fields']) && is_array($field['sub_fields']) )
		{
			foreach( $field['sub_fields'] as $f )
			{
				$this->create_new_field_keys( $f );
			}
		}
		elseif( isset($field['layouts']) && is_array($field['layouts']) )
		{
			foreach( $field['layouts'] as $layout )
			{
				if( isset($layout['sub_fields']) && is_array($layout['sub_fields']) )
				{
					foreach( $layout['sub_fields'] as $f )
					{
						$this->create_new_field_keys( $f );
					}
				}
				
			}
		}
	}
1249626
protected function initialize(array $fields)
    {
        $this->content = new Content;
        $this->revision = new Revision;

        foreach ($fields as $field => $settings) {
            $this->data[$field] = $this->initializeField($field, $settings);
        }
    }
635053
protected function updateFormField($field)
    {
        parent::updateFormField($field);

        if (is_numeric($this->MinLength) && $this->MinLength > 0) {
            $field->setAttribute('data-rule-minlength', intval($this->MinLength));
        }

        if (is_numeric($this->MaxLength) && $this->MaxLength > 0) {
            if ($field instanceof TextField) {
                $field->setMaxLength(intval($this->MaxLength));
            }
            $field->setAttribute('data-rule-maxlength', intval($this->MaxLength));
        }

        if ($this->Autocomplete) {
            $field->setAttribute('autocomplete', $this->Autocomplete);
        }
    }
590473
private void initButtons() {

        m_addButton.addChoice(
            m_attributeHandler.getWidgetService(),
            new CmsChoiceMenuEntryBean(m_attributeHandler.getAttributeName()),
            new AsyncCallback<CmsChoiceMenuEntryBean>() {

                public void onFailure(Throwable caught) {

                    // will not be called

                }

                public void onSuccess(CmsChoiceMenuEntryBean selectedEntry) {

                    // nothing to do
                }
            });
        m_addButton.addDomHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {

                m_addButton.hide();
                addNewAttributeValue();
                event.preventDefault();
                event.stopPropagation();

            }
        }, ClickEvent.getType());

        m_editButton.setImageClass(I_CmsButton.PEN_SMALL);
        m_editButton.setButtonStyle(ButtonStyle.FONT_ICON, null);

        m_removeButton.setImageClass(I_CmsButton.CUT_SMALL);
        m_removeButton.setButtonStyle(ButtonStyle.FONT_ICON, null);

        m_upButton.setImageClass(I_CmsButton.EDIT_UP_SMALL);
        m_upButton.setButtonStyle(ButtonStyle.FONT_ICON, null);

        m_downButton.setImageClass(I_CmsButton.EDIT_DOWN_SMALL);
        m_downButton.setButtonStyle(ButtonStyle.FONT_ICON, null);

        if (CmsEditorBase.hasDictionary()) {
            String label = m_widgetService.getAttributeLabel(m_attributeHandler.getAttributeName());
            m_addButton.setTitle(CmsEditorBase.getMessageForKey(CmsEditorBase.GUI_VIEW_ADD_1, label));
            m_removeButton.setTitle(CmsEditorBase.getMessageForKey(CmsEditorBase.GUI_VIEW_DELETE_1, label));
            m_upButton.setTitle(CmsEditorBase.getMessageForKey(CmsEditorBase.GUI_VIEW_MOVE_UP_0));
            m_downButton.setTitle(CmsEditorBase.getMessageForKey(CmsEditorBase.GUI_VIEW_MOVE_DOWN_0));
            m_title = CmsEditorBase.getMessageForKey(CmsEditorBase.GUI_VIEW_EDIT_1, label);
            m_editButton.setTitle(m_title);
        }
    }
653419
public function init()
	{
		parent::init();
		if($this->name===null)
			$this->sortable=false;
		if($this->name===null && $this->value===null)
			throw new CException(Yii::t('zii','Either "name" or "value" must be specified for CDataColumn.'));
	}
1151263
protected function addColumn($field)
    {
        // Let's see if they're setting
        // a limit, like: string[50]
        if ( str_contains($field->type, '[') )
        {
            preg_match('/([^\[]+?)\[(\d+)\]/', $field->type, $matches);
            $field->type = $matches[1]; // string
            $field->limit = $matches[2]; // 50
        }

        // We'll start building the appropriate Schema method
        $html = "\$table->{$field->type}";

        $html .= isset($field->limit)
            ? "('{$field->name}', {$field->limit})"
            : "('{$field->name}')";

        // Take care of any potential indexes or options
        if (isset($field->options))
        {
            $html .= $field->options;
        }

        return $html.';';
    }
232908
public function setField(Field $field, $index = 0)
    {
        $this->field = $field;
        $this->valueIndex = $index;
    }
164707
public function format_expander($field, $column)
    {
        if (!$this->current_row[$field]) {
            $this->current_row[$field] = $column['descr'];
        }

        // TODO:
        // reformat this using Button, once we have more advanced system to
        // bypass rendering of sub-elements.
        // $this->current_row[$field] = $this->add('Button',null,false)
        $key = $this->name.'_'.$field.'_';
        $id = $key.$this->app->normalizeName($this->model->id);
        $class = $key.'expander';

        $this->current_row_html[$field] =
            '<input type="checkbox" '.
                'class="'.$class.'" '.
                'id="'.$id.'" '.
                'rel="'.$this->app->url(
                    $column['page'] ?: './'.$field,
                    array(
                        'expander' => $field,
                        'expanded' => $this->name,
                        'cut_page' => 1,
                        // TODO: id is obsolete
                        //'id' => $this->model->id,
                        $this->columns[$field]['refid'].'_'.$this->model->id_field => $this->model->id,
                    )
                ).'" '.
            '/>'.
            '<label for="'.$id.'" style="cursor:pointer;"><a class="atk-button-small">'.
            $this->current_row[$field].'</a></label>';
    }