本文整理汇总了PHP中FLBuilderModel::get_modules方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::get_modules方法的具体用法?PHP FLBuilderModel::get_modules怎么用?PHP FLBuilderModel::get_modules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilderModel
的用法示例。
在下文中一共展示了FLBuilderModel::get_modules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_css
/**
* Renders and caches the CSS for a builder layout.
*
* @since 1.0
* @return void
*/
public static function render_css()
{
// Delete the old file.
FLBuilderModel::delete_asset_cache('css');
// Get info on the new file.
$nodes = FLBuilderModel::get_categorized_nodes();
$global_settings = FLBuilderModel::get_global_settings();
$asset_info = FLBuilderModel::get_asset_info();
$post_id = FLBuilderModel::get_post_id();
$post = get_post($post_id);
$compiled = array();
// Global css
$css = file_get_contents(FL_BUILDER_DIR . '/css/fl-builder-layout.css');
// Global RTL css
if (is_rtl()) {
$css .= file_get_contents(FL_BUILDER_DIR . '/css/fl-builder-layout-rtl.css');
}
// Responsive css
if ($global_settings->responsive_enabled) {
$css .= '@media (max-width: ' . $global_settings->medium_breakpoint . 'px) { ';
$css .= file_get_contents(FL_BUILDER_DIR . '/css/fl-builder-layout-medium.css');
$css .= ' }';
$css .= '@media (max-width: ' . $global_settings->responsive_breakpoint . 'px) { ';
$css .= file_get_contents(FL_BUILDER_DIR . '/css/fl-builder-layout-responsive.css');
if (!isset($global_settings->auto_spacing) || $global_settings->auto_spacing) {
$css .= file_get_contents(FL_BUILDER_DIR . '/css/fl-builder-layout-auto-spacing.css');
}
$css .= ' }';
}
// Global row margins
$css .= '.fl-row-content-wrap { margin: ' . $global_settings->row_margins . 'px; }';
// Global row padding
$css .= '.fl-row-content-wrap { padding: ' . $global_settings->row_padding . 'px; }';
// Global row width
$css .= '.fl-row-fixed-width { max-width: ' . $global_settings->row_width . 'px; }';
// Global module margins
$css .= '.fl-module-content { margin: ' . $global_settings->module_margins . 'px; }';
// Loop through rows
foreach ($nodes['rows'] as $row) {
// Instance row css
ob_start();
include FL_BUILDER_DIR . 'includes/row-css.php';
$css .= ob_get_clean();
// Instance row margins
$css .= self::render_row_margins($row);
// Instance row padding
$css .= self::render_row_padding($row);
}
// Loop through the columns.
foreach ($nodes['columns'] as $col) {
// Instance column css
ob_start();
include FL_BUILDER_DIR . 'includes/column-css.php';
$css .= ob_get_clean();
// Instance column margins
$css .= self::render_column_margins($col);
// Instance column padding
$css .= self::render_column_padding($col);
// Get the modules in this column.
$modules = FLBuilderModel::get_modules($col);
}
// Loop through the modules.
foreach ($nodes['modules'] as $module) {
// Global module css
$file = $module->dir . 'css/frontend.css';
$file_responsive = $module->dir . 'css/frontend.responsive.css';
// Only include global module css that hasn't been included yet.
if (!in_array($module->settings->type, $compiled)) {
// Add to the compiled array so we don't include it again.
$compiled[] = $module->settings->type;
// Get the standard module css.
if (file_exists($file)) {
$css .= file_get_contents($file);
}
// Get the responsive module css.
if ($global_settings->responsive_enabled && file_exists($file_responsive)) {
$css .= '@media (max-width: ' . $global_settings->responsive_breakpoint . 'px) { ';
$css .= file_get_contents($file_responsive);
$css .= ' }';
}
}
// Instance module css
$file = $module->dir . 'includes/frontend.css.php';
$settings = $module->settings;
$id = $module->node;
if (file_exists($file)) {
ob_start();
include $file;
$css .= ob_get_clean();
}
// Instance module margins
$css .= self::render_module_margins($module);
if (!isset($global_settings->auto_spacing) || $global_settings->auto_spacing) {
$css .= self::render_responsive_module_margins($module);
//.........这里部分代码省略.........
示例2: render_modules
/**
* Renders the markup for all modules in a column.
*
* @since 1.0
* @param string $parent_id A column node ID.
* @return void
*/
public static function render_modules($parent_id)
{
$modules = FLBuilderModel::get_modules($parent_id);
foreach ($modules as $module) {
$settings = $module->settings;
include FL_BUILDER_DIR . 'includes/module.php';
}
}