本文整理汇总了PHP中ctools_export_get_schema函数的典型用法代码示例。如果您正苦于以下问题:PHP ctools_export_get_schema函数的具体用法?PHP ctools_export_get_schema怎么用?PHP ctools_export_get_schema使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ctools_export_get_schema函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
$this->rows[$name]['data'][] = array('data' => check_plain($item->name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->size), 'class' => array('ctools-export-ui-size'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->block) ? t('Yes') : t('No'), 'class' => array('ctools-export-ui-block'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
}
示例2: list_build_row
public function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->name;
$schema = ctools_export_get_schema($this->plugin['schema']);
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = $item->weight;
break;
case 'disabled_title':
$this->sorts[$name] = empty($item->disabled) . $item->admin_title;
break;
case 'title':
$this->sorts[$name] = $item->admin_title;
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$role_list = $this->buildRoleList($item->role_rids);
$this->rows[$name] = array('data' => array(array('data' => check_plain($item->admin_title), 'class' => array('ctools-export-ui-title')), array('data' => check_plain($name), 'class' => array('ctools-export-ui-name')), array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage')), array('data' => check_plain($role_list), 'class' => array('ctools-export-ui-roles')), array('data' => check_plain($item->weight), 'class' => array('ctools-export-ui-weight')), array('data' => $ops, 'class' => array('ctools-export-ui-operations'))), 'class' => array(!empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled'));
}
示例3: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Warn users if network id has no value. This can happen immediatly after
// the module is installed.
if (variable_get('dfp_network_id', '') == '') {
drupal_set_message(t('DFP ad tags will not work until you have <a href="/admin/structure/dfp_ads/settings">set your network id</a> as provided by Google.'), 'warning', FALSE);
}
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
$this->rows[$name]['data'][] = array('data' => check_plain($item->slot), 'class' => array('ctools-export-ui-slot'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->size), 'class' => array('ctools-export-ui-size'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->block) ? t('Yes') : t('No'), 'class' => array('ctools-export-ui-block'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
}
示例4: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
public function list_build_row($item, &$form_state, $operations)
{
// Set up sorting.
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
list($plugin_manager, $plugin_id) = explode(':', $item->factory_service);
list($module, $plugin_type) = explode('.', $plugin_manager);
// Note: $item->{$schema['export']['export type string']} should have
// already been set up by export.inc so we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'class':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
switch ($item->type) {
case t('Default'):
default:
$type = t('In code');
break;
case t('Normal'):
$type = t('In database');
break;
case t('Overridden'):
$type = t('Database overriding code');
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->factory_service), 'class' => array('ctools-export-ui-service'));
$this->rows[$name]['data'][] = array('data' => $type, 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例5: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
public function list_build_row($item, &$form_state, $operations)
{
// Set up sorting.
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
list($plugin_manager, $plugin_id) = explode(':', $item->factory_service);
list($module, $plugin_type) = explode('.', $plugin_manager);
$object = \Drupal\openlayers\Openlayers::load($plugin_type, $item->machine_name);
// Note: $item->{$schema['export']['export type string']} should have
// already been set up by export.inc so we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'class':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
// Generate a map and use the style on it to make a preview.
$map = Openlayers::load('map', 'openlayers_ui_map_style_demo');
foreach ($map->getCollection()->getFlatList(array('layer')) as $layer) {
$layer->setStyle($object);
$map->getCollection()->import(array($layer));
}
$map_build = $map->build();
$map_render = drupal_render($map_build);
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
$this->rows[$name]['data'][] = array('data' => $map_render, 'class' => array('ctools-export-ui-title'));
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->factory_service), 'class' => array('ctools-export-ui-service'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例6: save
/**
* Save the picture mapping.
*
* @return
* If the record insert or update failed, returns FALSE. If it succeeded,
* returns SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
*/
public function save()
{
$update = array();
$this->cleanMappings();
$data = $this->toArray();
if (isset($this->id) && $this->id) {
$update = array('id');
$data['id'] = $this->id;
}
$return = drupal_write_record('picture_mapping', $data, $update);
$this->setValues(ctools_export_get_schema('picture_mapping'), $data);
$this->loadBreakpointGroup();
return $return;
}
示例7: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$layers_types = openlayers_layer_types();
$this->rows[$name]['data'][] = array('data' => $item->title, 'class' => array('ctools-export-ui-title'));
$this->rows[$name]['data'][] = array('data' => $layers_types[$item->data['layer_type']]['title'], 'class' => array('ctools-export-ui-layer-type'));
$this->rows[$name]['data'][] = array('data' => $item->description, 'class' => array('ctools-export-ui-description'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
// This should be in the module openlayers_views, but I'm still looking
// for a solution to do it properly.
if ($item->data['layer_type'] == 'openlayers_views_vector') {
$operations['edit']['href'] = 'admin/structure/views/view/' . $item->data['views']['view'] . '/edit/' . $item->data['views']['display'];
$operations['disable']['href'] = 'admin/structure/views/view/' . $item->data['views']['view'] . '/disable/' . $item->data['views']['display'];
$operations['clone']['href'] = 'admin/structure/views/view/' . $item->data['views']['view'] . '/clone/' . $item->data['views']['display'];
$operations['export']['href'] = 'admin/structure/views/view/' . $item->data['views']['view'] . '/export/' . $item->data['views']['display'];
}
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例8: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
dsm($item);
$instance = is_object($item->data) ? $item->data : (object) unserialize($item->data);
$visibility = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'));
$pages = $instance->pages != substr($instance->pages, 0, 40) ? substr($instance->pages, 0, 40) . '...' : substr($instance->pages, 0, 40);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
// Show element, style, visibility and pages.
$this->rows[$name]['data'][] = array('data' => check_plain($instance->element));
$this->rows[$name]['data'][] = array('data' => check_plain($instance->style));
$this->rows[$name]['data'][] = array('data' => $visibility[$instance->visibility]);
$this->rows[$name]['data'][] = array('data' => check_plain($pages));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例9: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Load Custom Formatters engines.
$engines = module_invoke_all('custom_formatters_engine_info');
// Hide Formatters using missing engines.
if (!isset($engines[$item->mode])) {
unset($this->row);
return;
}
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($engines[$item->mode]['label']), 'class' => array('ctools-export-ui-format'));
$this->rows[$name]['data'][] = array('data' => !empty($item->fapi) && drupal_strlen($item->fapi) > 17 ? t('Yes') : t('No'), 'class' => array('ctools-export-ui-fapi'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例10: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// Add the icon as an image in the row if it exists.
if (isset($item->data['externalGraphic'])) {
$style = theme('image', array('path' => $item->data['externalGraphic']));
} else {
$style = openlayers_ui_style_preview($item);
}
$this->rows[$name]['data'][] = array('data' => $style, 'class' => array('ctools-export-ui-preview'));
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => $item->title, 'class' => array('ctools-export-ui-title'));
$this->rows[$name]['data'][] = array('data' => $item->description, 'class' => array('ctools-export-ui-description'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例11: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$layers = openlayers_layers_load();
foreach ($item->data['layers'] as $layer) {
$layers_names[] = empty($layers[$layer]->title) ? $layer : filter_xss_admin($layers[$layer]->title);
}
sort($layers_names);
$layers_names = implode(',', $layers_names);
$this->rows[$name]['data'][] = array('data' => $item->title, 'class' => array('ctools-export-ui-title'));
$this->rows[$name]['data'][] = array('data' => $layers_names, 'class' => array('ctools-export-ui-layers'));
$this->rows[$name]['data'][] = array('data' => $item->description, 'class' => array('ctools-export-ui-description'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例12: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'weight':
$this->sorts[$name] = $item->weight;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
// Add the draggable class.
$this->rows[$name]['class'] = array('draggable');
$this->rows[$name]['class'][] = !empty($item->disabled) ? 'ctools-export-ui-disabled' : 'ctools-export-ui-enabled';
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
$ops = theme('links__ctools_dropbutton', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
// Add the order column. This is only a placeholder replaced later in the form theme function.
$this->rows[$name]['data'][] = array('data' => check_plain($item->weight));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例13: list_build_row
/**
* Build a row based on the item.
*
* By default all of the rows are placed into a table by the render
* method, so this is building up a row suitable for theme('table').
* This doesn't have to be true if you override both.
*/
function list_build_row($item, &$form_state, $operations)
{
// Set up sorting
$name = $item->{$this->plugin['export']['key']};
$schema = ctools_export_get_schema($this->plugin['schema']);
// Note: $item->{$schema['export']['export type string']} should have already been set up by export.inc so
// we can use it safely.
switch ($form_state['values']['order']) {
case 'disabled':
$this->sorts[$name] = empty($item->disabled) . $name;
break;
case 'title':
$this->sorts[$name] = $item->{$this->plugin['export']['admin_title']};
break;
case 'name':
$this->sorts[$name] = $name;
break;
case 'storage':
$this->sorts[$name] = $item->{$schema['export']['export type string']} . $name;
break;
}
$this->rows[$name]['data'] = array();
$this->rows[$name]['class'] = !empty($item->disabled) ? array('ctools-export-ui-disabled') : array('ctools-export-ui-enabled');
// If we have an admin title, make it the first row.
if (!empty($this->plugin['export']['admin_title'])) {
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$this->plugin['export']['admin_title']}), 'class' => array('ctools-export-ui-title'));
}
$this->rows[$name]['data'][] = array('data' => check_plain($name), 'class' => array('ctools-export-ui-name'));
$this->rows[$name]['data'][] = array('data' => check_plain($item->{$schema['export']['export type string']}), 'class' => array('ctools-export-ui-storage'));
// To display whether this has any description
$snippet = $this->load_item($name);
$label = "No";
if ($snippet->rid) {
$label = 'Yes';
}
$this->rows[$name]['data'][] = array('data' => $label, 'class' => array('ctools-export-ui-title'));
// short down the list of operation as per permission
$snippet_operations = array();
foreach ($operations as $key => $value) {
$do_list = $key == 'enable' || $key == 'disable' ? TRUE : $this->access($key, $item);
if ($do_list) {
$snippet_operations[$key] = $value;
}
}
$ops = theme('links__ctools_dropbutton', array('links' => $snippet_operations, 'attributes' => array('class' => array('links', 'inline'))));
$this->rows[$name]['data'][] = array('data' => $ops, 'class' => array('ctools-export-ui-operations'));
// Add an automatic mouseover of the description if one exists.
if (!empty($this->plugin['export']['admin_description'])) {
$this->rows[$name]['title'] = $item->{$this->plugin['export']['admin_description']};
}
}
示例14: edit_form_submit
/**
* Handle the submission of the edit form.
*
* At this point, submission is successful. Our only responsibility is
* to copy anything out of values onto the item that we are able to edit.
*
* If the keys all match up to the schema, this method will not need to be
* overridden.
*/
function edit_form_submit(&$form, &$form_state)
{
if (!empty($this->plugin['form']['submit'])) {
// Pass $form by reference.
$this->plugin['form']['submit']($form, $form_state);
}
// Transfer data from the form to the $item based upon schema values.
$schema = ctools_export_get_schema($this->plugin['schema']);
foreach (array_keys($schema['fields']) as $key) {
if (isset($form_state['values'][$key])) {
$form_state['item']->{$key} = $form_state['values'][$key];
}
}
}
示例15: list_form_submit
/**
* Submit the filter/sort form.
*
* This submit handler is actually responsible for building up all of the
* rows that will later be rendered, since it is doing the filtering and
* sorting.
*
* For the most part, you should not need to override this method, as the
* fiddly bits call through to other functions.
*/
function list_form_submit(&$form, &$form_state)
{
// Filter and re-sort the pages.
$plugin = $this->plugin;
$schema = ctools_export_get_schema($this->plugin['schema']);
$prefix = ctools_export_ui_plugin_base_path($plugin);
foreach ($this->items as $name => $item) {
// Call through to the filter and see if we're going to render this
// row. If it returns TRUE, then this row is filtered out.
if ($this->list_filter($form_state, $item)) {
continue;
}
// Note: Creating this list seems a little clumsy, but can't think of
// better ways to do this.
$allowed_operations = drupal_map_assoc(array_keys($plugin['allowed operations']));
//Cannot find the code that returns the list of possible operations, so I'm going to add extras here, which is not neat.
//$allowed_operations['edit terms'] = 'edit terms';
$not_allowed_operations = array('import');
if ($item->{$schema['export']['export type string']} == t('Normal')) {
$not_allowed_operations[] = 'revert';
} elseif ($item->{$schema['export']['export type string']} == t('Overridden')) {
$not_allowed_operations[] = 'delete';
} else {
$not_allowed_operations[] = 'revert';
$not_allowed_operations[] = 'delete';
}
//$not_allowed_operations[] = empty($item->disabled) ? 'enable' : 'disable';
//Forcing 'disable' and 'enable' to be disabled always. This should be done in the install schema with 'can disable' => FALSE, but that would
//mean reinstalling the module and I don't think it works properly.
$not_allowed_operations[] = 'disable';
$not_allowed_operations[] = 'enable';
foreach ($not_allowed_operations as $op) {
// Remove the operations that are not allowed for the specific
// exportable.
unset($allowed_operations[$op]);
}
$operations = array();
foreach ($allowed_operations as $op) {
$operations[$op] = array('title' => $plugin['allowed operations'][$op]['title'], 'href' => ctools_export_ui_plugin_menu_path($plugin, $op, $name));
if (!empty($plugin['allowed operations'][$op]['ajax'])) {
$operations[$op]['attributes'] = array('class' => array('use-ajax'));
}
if (!empty($plugin['allowed operations'][$op]['token'])) {
$operations[$op]['query'] = array('token' => drupal_get_token($op));
}
}
$this->list_build_row($item, $form_state, $operations);
}
// Now actually sort
if ($form_state['values']['sort'] == 'desc') {
arsort($this->sorts);
} else {
asort($this->sorts);
}
// Nuke the original.
$rows = $this->rows;
$this->rows = array();
// And restore.
foreach ($this->sorts as $name => $title) {
$this->rows[$name] = $rows[$name];
}
}