0

I have a content type wherein the user will add holidays.

It has Holiday Date field(field_holiday_date).

How can I get the dates in that column using query and use it as an array in Computed field?

enter image description here

Thanks for you help!

0

You can pass any value of node or something else in jquery like

$node_id = 5;
$node = node_load($node_id);
$settings = array(
    'title' => $node->title,
    'custom-data' => 'ABC',
);
drupal_add_js(array('mymodule' => $settings), 'setting');
drupal_add_js(drupal_get_path('module', 'mymodule') . '/js/mymodule.js', 'file');

And get that value in jquery like (you have to put this code in mymodule.js)

(function($) {
        Drupal.behaviors.mymodule = {
            attach: function(context, settings) {            
                var title = Drupal.settings.mymodule.title;
                console.log(title); // or perform some operation as you prefer
                var custom_data = Drupal.settings.mymodule.custom-data;
                console.log(custom_data );
            }
        };
    }(jQuery));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.