public function init() { // ----- EXTENSION POINT // IDs aller Feldtypen bei denen das Parameter-Feld eingeblendet werden soll $typeFields = rex_extension::registerPoint(new rex_extension_point('METAINFO_TYPE_FIELDS', [REX_METAINFO_FIELD_SELECT, REX_METAINFO_FIELD_RADIO, REX_METAINFO_FIELD_CHECKBOX, REX_METAINFO_FIELD_REX_MEDIA_WIDGET, REX_METAINFO_FIELD_REX_MEDIALIST_WIDGET, REX_METAINFO_FIELD_REX_LINK_WIDGET, REX_METAINFO_FIELD_REX_LINKLIST_WIDGET])); $field = $this->addReadOnlyField('prefix', $this->metaPrefix); $field->setLabel(rex_i18n::msg('minfo_field_label_prefix')); $field = $this->addTextField('name'); $field->setLabel(rex_i18n::msg('minfo_field_label_name')); $field = $this->addSelectField('priority'); $field->setLabel(rex_i18n::msg('minfo_field_label_priority')); $select = $field->getSelect(); $select->setSize(1); $select->addOption(rex_i18n::msg('minfo_field_first_priority'), 1); // Im Edit Mode das Feld selbst nicht als Position einf�gen $qry = 'SELECT name,priority FROM ' . $this->tableName . ' WHERE `name` LIKE "' . $this->metaPrefix . '%"'; if ($this->isEditMode()) { $qry .= ' AND id != ' . $this->getParam('field_id'); } $qry .= ' ORDER BY priority'; $sql = rex_sql::factory(); $sql->setQuery($qry); $value = 1; for ($i = 0; $i < $sql->getRows(); ++$i) { $value = $sql->getValue('priority') + 1; $select->addOption(rex_i18n::rawMsg('minfo_field_after_priority', $sql->getValue('name')), $value); $sql->next(); } if (!$this->isEditMode()) { $select->setSelected($value); } $field = $this->addTextField('title'); $field->setLabel(rex_i18n::msg('minfo_field_label_title')); $field->setNotice(rex_i18n::msg('minfo_field_notice_title')); $gq = rex_sql::factory(); $gq->setQuery('SELECT dbtype,id FROM ' . rex::getTablePrefix() . 'metainfo_type'); $textFields = []; foreach ($gq->getArray() as $f) { if ($f['dbtype'] == 'text') { $textFields[$f['id']] = $f['id']; } } $field = $this->addSelectField('type_id'); $field->setLabel(rex_i18n::msg('minfo_field_label_type')); $field->setAttribute('onchange', 'meta_checkConditionalFields(this, new Array(' . implode(',', $typeFields) . '), new Array(' . implode(',', $textFields) . '));'); $select = $field->getSelect(); $select->setSize(1); $qry = 'SELECT label,id FROM ' . rex::getTablePrefix() . 'metainfo_type'; $select->addSqlOptions($qry); $notices = ''; for ($i = 1; $i < REX_METAINFO_FIELD_COUNT; ++$i) { if (rex_i18n::hasMsg('minfo_field_params_notice_' . $i)) { $notices .= '<span id="metainfo-field-params-notice-' . $i . '" style="display:none">' . rex_i18n::msg('minfo_field_params_notice_' . $i) . '</span>' . "\n"; } } $notices .= ' <script type="text/javascript"> var needle = new getObj("' . $field->getAttribute('id') . '"); meta_checkConditionalFields(needle.obj, new Array(' . implode(',', $typeFields) . '), new Array(' . implode(',', $textFields) . ')); </script>'; $field = $this->addTextAreaField('params'); $field->setLabel(rex_i18n::msg('minfo_field_label_params')); $field->setNotice($notices); $field = $this->addTextAreaField('attributes'); $field->setLabel(rex_i18n::msg('minfo_field_label_attributes')); $notice = rex_i18n::msg('minfo_field_attributes_notice') . "\n"; $field->setNotice($notice); $field = $this->addTextAreaField('callback'); $field->setLabel(rex_i18n::msg('minfo_field_label_callback')); $notice = rex_i18n::msg('minfo_field_label_notice') . "\n"; $field->setNotice($notice); $field = $this->addTextField('default'); $field->setLabel(rex_i18n::msg('minfo_field_label_default')); if ('clang_' !== $this->metaPrefix) { $attributes = []; $attributes['internal::fieldClass'] = 'rex_form_restrictons_element'; $field = $this->addField('', 'restrictions', null, $attributes); $field->setLabel(rex_i18n::msg('minfo_field_label_restrictions')); $field->setAttribute('size', 10); $field->setAttribute('class', 'form-control'); } parent::init(); }
/** * Translates the given key. * * @param string $key Key * * @return string Tranlates text */ protected function i18n($key) { $args = func_get_args(); $key = $this->i18nPrefix . $args[0]; if (!rex_i18n::hasMsg($key)) { $key = 'package_' . $args[0]; } $args[0] = $key; return call_user_func_array(['rex_i18n', 'msg'], $args); }
/** * {@inheritdoc} */ public function i18n($key) { $args = func_get_args(); $key = $this->getName() . '_' . $key; if (rex_i18n::hasMsg($key)) { $args[0] = $key; } return call_user_func_array('rex_i18n::msg', $args); }
/** * Registers a new permission. * * @param string $perm Perm key * @param string $name Perm name * @param string $group Perm group, possible values are rex_perm::GENERAL, rex_perm::OPTIONS and rex_perm::EXTRAS */ public static function register($perm, $name = null, $group = self::GENERAL) { $name = $name ?: (rex_i18n::hasMsg($key = 'perm_' . $group . '_' . $perm) ? rex_i18n::msg($key) : $perm); self::$perms[$group][$perm] = $name; }