Your IP : 216.73.216.229


Current Path : /home/j/e/r/jeromecohp/www/plugins/system/fs_grid/element/fs_grid_item/
Upload File :
Current File : /home/j/e/r/jeromecohp/www/plugins/system/fs_grid/element/fs_grid_item/element.php

<?php
/**
 * @package   Grid 10 element for YOOtheme Pro
 * @author    Flart Studio https://www.flart.studio
 * @copyright Copyright (C) Flart Studio
 * @license   GNU General Public License version 3, or later
 */

namespace YOOtheme;

// No direct access to this file
defined('_JEXEC') or die();

return [
    'transforms' => [
        'render' => function ($node, $params) {
            // Display
            foreach (['title', 'meta', 'content', 'link', 'image'] as $key) {
                if (!$params['parent']->props["show_{$key}"]) {
                    $node->props[$key] = '';
                    if ($key === 'image') {
                        $node->props['icon'] = '';
                    }
                }
            }

            $node->props['has_custom_content'] = false;
            $node->props['grid_1_has_content'] = false;
            $node->props['grid_2_has_content'] = false;
            foreach (['custom_1', 'custom_2', 'custom_3', 'custom_4', 'custom_5', 'custom_6', 'custom_7', 'custom_8', 'custom_9', 'custom_10'] as $i => $key) {
                $i += 1;
                if (!$params['parent']->props['use_custom_fields']) {
                    $node->props["custom_text_{$i}"] = '';
                } elseif (!$params['parent']->props["show_{$key}"]) {
                    $node->props["custom_text_{$i}"] = '';
                } else {
                    if ($node->props["custom_text_{$i}"]) {
                        $node->props['has_custom_content'] = true;
                        if ($params['parent']->props["custom_{$i}_grid"] === "1") {
                            $node->props['grid_1_has_content'] = true;
                        } elseif ($params['parent']->props["custom_{$i}_grid"] === "2") {
                            $node->props['grid_2_has_content'] = true;
                        }
                    }
                }
            }

            // Don't render element if content fields are empty
            return $node->props['title'] != '' ||
                $node->props['meta'] != '' ||
                $node->props['content'] != '' ||
                $node->props['custom_text_1'] != '' ||
                $node->props['custom_text_2'] != '' ||
                $node->props['custom_text_3'] != '' ||
                $node->props['custom_text_4'] != '' ||
                $node->props['custom_text_5'] != '' ||
                $node->props['custom_text_6'] != '' ||
                $node->props['custom_text_7'] != '' ||
                $node->props['custom_text_8'] != '' ||
                $node->props['custom_text_9'] != '' ||
                $node->props['custom_text_10'] != '' ||
                $node->props['image'] ||
                $node->props['icon'] ||
                $node->props['link'];
        },
    ],

    'updates' => [
        '2.5.0-beta.1.3' => function ($node) {
            if (!empty($node->props['tags'])) {
                $node->props['tags'] = ucwords($node->props['tags']);
            }
        },
    ],
];