diff --git a/plg_cck_field_juicon/juicon.php b/plg_cck_field_juicon/juicon.php new file mode 100644 index 0000000..297fb62 --- /dev/null +++ b/plg_cck_field_juicon/juicon.php @@ -0,0 +1,225 @@ +g_onCCK_FieldConstruct($data); + } + + /** + * @param $field + * @param $style + * @param array $data + * @param array $config + * + * @return void + * @since 1.0 + */ + public static function onCCK_FieldConstruct_SearchSearch(&$field, $style, $data = [], &$config = []) + { + $data[ 'live' ] = null; + $data[ 'match_mode' ] = null; + $data[ 'validation' ] = null; + $data[ 'variation' ] = null; + + parent::onCCK_FieldConstruct_SearchSearch($field, $style, $data, $config); + } + + /** + * @param $field + * @param $style + * @param array $data + * @param array $config + * + * @return void + * @since 1.0 + */ + public static function onCCK_FieldConstruct_TypeForm(&$field, $style, $data = [], &$config = []) + { + $data[ 'live' ] = null; + $data[ 'validation' ] = null; + $data[ 'variation' ] = null; + + parent::onCCK_FieldConstruct_TypeForm($field, $style, $data, $config); + } + + /** + * @param $field + * @param string $value + * @param array $config + * + * @return void + * @since 1.0 + */ + public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = []): void + { + if(self::$type !== $field->type) + { + return; + } + + self::g_onCCK_FieldPrepareContent($field, $config); + + $options2 = JCckDev::fromJSON($field->options2); + $html = (new FileLayout('icon', JPATH_SITE . '/plugins/cck_field/juicon/tmpl'))->render([ + 'sprite' => $options2[ 'sprite' ], + 'icon' => $field->location, + 'size' => $options2[ 'size' ], + 'class' => ($options2[ 'class' ] ? : '') + ]); + + $field->text = $html; + $field->typo_target = 'text'; + $field->value = $field->location; + } + + /** + * @param $field + * @param string $value + * @param array $config + * @param array $inherit + * @param bool $return + * + * @return void + * @since 1.0 + */ + public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = [], $inherit = [], $return = false) + { + if(self::$type !== $field->type) + { + return; + } + + self::$path = self::g_getPath(self::$type . '/'); + self::g_onCCK_FieldPrepareForm($field, $config); + + $options2 = JCckDev::fromJSON($field->options2); + $form = (new FileLayout('icon', JPATH_SITE . '/plugins/cck_field/juicon/tmpl'))->render([ + 'sprite' => $options2[ 'sprite' ], + 'icon' => $field->location, + 'size' => $options2[ 'size' ], + 'class' => ($options2[ 'class' ] ? : '') + ]); + + $field->form = $form; + $field->value = $field->location; + + if($return === true) + { + return $field; + } + } + + /** + * @param $field + * @param string $value + * @param array $config + * @param array $inherit + * @param bool $return + * + * @return void + * @since 1.0 + */ + public function onCCK_FieldPrepareSearch(&$field, $value = '', &$config = [], $inherit = [], $return = false) + { + if(self::$type !== $field->type) + { + return; + } + + $this->onCCK_FieldPrepareForm($field, $value, $config, $inherit, $return); + + if($return === true) + { + return $field; + } + } + + /** + * @param $field + * @param string $value + * @param array $config + * @param array $inherit + * @param bool $return + * + * @return void|bool + * @since 1.0 + */ + public function onCCK_FieldPrepareStore($field, $value = '', &$config = [], $inherit = [], $return = false) + { + if(self::$type !== $field->type) + { + return true; + } + } + + /** + * @param $field + * @param array $config + * + * @return mixed + * @since 1.0 + */ + public static function onCCK_FieldRenderContent($field, &$config = []) + { + return parent::g_onCCK_FieldRenderContent($field, 'text'); + } + + /** + * @param $field + * @param array $config + * + * @return mixed + * @since 1.0 + */ + public static function onCCK_FieldRenderForm($field, &$config = []) + { + return parent::g_onCCK_FieldRenderForm($field); + } +} \ No newline at end of file diff --git a/plg_cck_field_juicon/juicon.xml b/plg_cck_field_juicon/juicon.xml new file mode 100644 index 0000000..a4f7658 --- /dev/null +++ b/plg_cck_field_juicon/juicon.xml @@ -0,0 +1,45 @@ + + + plg_cck_field_juicon + Denys Nosov (Joomla! Ukraine) + denys@joomla-ua.org + https://joomla-ua.org + Copyright (C) 2017-2022 Joomla! Ukraine. All Rights Reserved. + GNU General Public License version 2 or later. + @date@ + JUIcon Field Plug-in for SEBLOD // SEBLOD 4.x - Joomla! Ukraine + @version@ + + install/script.php + + + assets + classes + install + tmpl + juicon.php + + + + en-GB/plg_cck_field_juicon.ini + en-GB/plg_cck_field_juicon.sys.ini + + + + +
+ +
+ +
+ + +
+
+
+ + + https://joomla-ua.org/update/plg/plg_cck_field_juicon.xml + + +
\ No newline at end of file diff --git a/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.ini b/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.ini new file mode 100644 index 0000000..a38f784 --- /dev/null +++ b/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.ini @@ -0,0 +1,7 @@ +PLG_CCK_FIELD_JUICON="JUIcon Field Plug-in for SEBLOD" +PLG_CCK_FIELD_JUICON_LABEL="JUIcon" +PLG_CCK_FIELD_JUICON_LABEL2="JUIcon" +PLG_CCK_FIELD_JUICON_DESC="JUIcon.." +PLG_CCK_FIELD_GROUP_HTML="HTML" +COM_CCK_SPRITE_PATH="Path to SVG sprite" +COM_CCK_ADD_SPRITE_PATH="First, add the path to the svg-sprite relative to the site root. For example: /app/icons/sprite.svg. After saving, you will be able to choose your icon" \ No newline at end of file diff --git a/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.sys.ini b/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.sys.ini new file mode 100644 index 0000000..669a83e --- /dev/null +++ b/plg_cck_field_juicon/languages/en-GB/plg_cck_field_juicon.sys.ini @@ -0,0 +1 @@ +PLG_CCK_FIELD_JUICON="JUIcon Field Plug-in for SEBLOD" \ No newline at end of file