class OpenlayersMaps in Openlayers 7.3
Class openlayers_components_ui.
Hierarchy
- class \Drupal\openlayers_ui\UI\OpenlayersMaps extends \Drupal\openlayers_ui\UI\OpenlayersObjects
Expanded class hierarchy of OpenlayersMaps
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersMaps.php, line 12 - Class openlayers_components_ui.
Namespace
Drupal\openlayers_ui\UIView source
class OpenlayersMaps extends \OpenlayersObjects {
/**
* {@inheritdoc}
*/
public function hook_menu(&$items) {
parent::hook_menu($items);
$items['admin/structure/openlayers/maps']['type'] = MENU_LOCAL_TASK;
$items['admin/structure/openlayers/maps']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
$items['admin/structure/openlayers/maps']['weight'] = -10;
}
/**
* {@inheritdoc}
*/
public function delete_form_submit(&$form_state) {
parent::delete_form_submit($form_state);
if (\Drupal::service('module_handler')
->moduleExists('openlayers_block')) {
$delta = _openlayers_block_get_block_id($form_state['item']->machine_name);
db_delete('block')
->condition('module', 'openlayers')
->condition('delta', $delta)
->execute();
}
}
/**
* Provide the table header.
*
* If you've added columns via list_build_row() but are still using a
* table, override this method to set up the table header.
*/
public function list_table_header() {
$header = array();
if (!empty($this->plugin['export']['admin_title'])) {
$header[] = array(
'data' => t('Name'),
'class' => array(
'ctools-export-ui-title',
),
);
}
$header[] = array(
'data' => t('Machine name'),
'class' => array(
'ctools-export-ui-name',
),
);
$header[] = array(
'data' => t('Service'),
'class' => array(
'ctools-export-ui-service',
),
);
$header[] = array(
'data' => t('Storage'),
'class' => array(
'ctools-export-ui-storage',
),
);
$header[] = array(
'data' => t('Operations'),
'class' => array(
'ctools-export-ui-operations',
),
);
return $header;
}
/**
* 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']);
// 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;
}
$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',
),
);
}
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(
'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']};
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenlayersMaps:: |
public | function | ||
OpenlayersMaps:: |
public | function | ||
OpenlayersMaps:: |
public | function | Build a row based on the item. | |
OpenlayersMaps:: |
public | function | Provide the table header. |