$id in frontend.php

Is it possible to access the $id variable in the frontend.php file?

Hey Steve,

That particular variable isn’t accessible, although it should be (I’ll add that in the next release). For now you can access the module’s id like this…

$module->node

Let me know if you run into any issues with that.

Justin

That works, thanks!

Seems like $id isn’t still accessible in the current version Beaver Builder, or I’m I wrong?

The documentation says it should be:

http://forum.wpbeaverbuilder.com/custom-module-documentation/

Greetings
Daniel

I just checked and it should be. We have this code in FLBuilder::render_module_html…

// Shorthand reference to the module's id.
		$id = $module->node;

		include $module->dir .'includes/frontend.php';

Is it not set for you?

Justin

Hi Justin,

I have no “include …” in my module, because I’ve built it based on your “bb-custom-module-examples” and if I do something like this:

<input type="hidden" name="node" value="<?php echo $id; ?>">

in frontend.php I always get:

Notice: Undefined variable: id in …

Cheers
Daniel

Hey Daniel,

You don’t need an include, that’s in the core code. I just checked again and there is another spot that we’re including frontend.php that doesn’t have $id. I’ve made a note to get that in the next release.

Thanks,
Justin