Ip\Internal\Content\Widget\Form\Controller::dataForJs PHP Method

dataForJs() public method

public dataForJs ( $revisionId, $widgetId, $data, $skin )
    public function dataForJs($revisionId, $widgetId, $data, $skin)
    {
        //collect available field types
        $fieldTypeObjects = Model::getAvailableFieldTypes();
        $fieldTypes = array();
        foreach ($fieldTypeObjects as $typeObject) {
            $fieldTypes[$typeObject->getKey()] = array('key' => $typeObject->getKey(), 'title' => $typeObject->getTitle(), 'optionsInitFunction' => $typeObject->getJsOptionsInitFunction(), 'optionsSaveFunction' => $typeObject->getJsOptionsSaveFunction(), 'optionsHtml' => $typeObject->getJsOptionsHtml());
        }
        $data['fieldTypes'] = $fieldTypes;
        if (empty($data['fields'])) {
            $data['fields'] = array();
            $data['fields'][] = array('type' => 'Text', 'label' => __('Name', 'Ip', false), 'options' => array());
            $data['fields'][] = array('type' => 'Email', 'label' => __('Email', 'Ip', false), 'options' => array());
            $data['fields'][] = array('type' => 'Textarea', 'label' => __('Text', 'Ip', false), 'options' => array());
        }
        return $data;
    }