Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Create array containing variables and their values
<?php compact(array|string $var_name, array|string ...$var_names): array
<?php public function fields()
{
$fields = collect($this->fieldItems())->map(function ($field, $handle) {
return compact('handle', 'field');
});
return new Fields($fields);
<?php unset($data['content']);
}
return compact('data', 'content');
}
<?php return ($field['prefix'] ?? null).$field['import'];
})->mapWithKeys(function ($field, $partial) {
return (new Fields([$field]))->all()->map(function ($field) use ($partial) {
return compact('partial', 'field');
});
});
<?php public function ensureFieldInSection($handle, $config, $section, $prepend = false)
{
$this->ensuredFields[] = compact('handle', 'section', 'prepend', 'config');
$this->resetFieldsCache();
<?php public function ensureFieldsInSection($fields, $section, $prepend = false)
{
foreach ($fields as $handle => $config) {
$this->ensuredFields[] = compact('handle', 'section', 'prepend', 'config');
}
$this->resetFieldsCache();
<?php public function makeFromFields($fields)
{
$fields = collect($fields)->map(function ($field, $handle) {
return compact('handle', 'field');
})->values()->all();
return (new Blueprint)->setContents(['fields' => $fields]);
<?php {
$sections = collect($sections)->map(function ($section, $section_handle) {
$fields = collect($section['fields'])->map(function ($field, $handle) {
return compact('handle', 'field');
});
$section['fields'] = $fields;
<?php return $section;
})->all();
return (new Blueprint)->setContents(compact('sections'));
}
public function in(string $namespace)
<?php if (! empty($fields) && array_keys($fields)[0] !== 0) {
$fields = collect($fields)->map(function ($field, $handle) {
return compact('handle', 'field');
})->values()->all();
}
<?php public function configFields(): Fields
{
$fields = collect($this->configFieldItems())->map(function ($field, $handle) {
return compact('handle', 'field');
});
return new ConfigFields($fields);
<?php $fieldtype = $field->type();
$config = $field->config();
return compact('display', 'handle', 'fieldtype', 'config', 'value');
});
}
<?php return Str::startsWith($line, ['D ', ' D']);
})->count();
return compact('status', 'totalCount', 'addedCount', 'modifiedCount', 'deletedCount');
}
<?php ->entryBlueprints()
->each->addGqlTypes()
->map(function ($blueprint) use ($collection) {
return compact('collection', 'blueprint');
});
});
<?php ->entryBlueprints()
->each->addGqlTypes()
->map(function ($blueprint) use ($nav, $collection) {
return compact('nav', 'collection', 'blueprint');
});
})->map(function ($item) {
return new NavEntryPageType($item['nav'], $item['collection'], $item['blueprint']);
<?php ->termBlueprints()
->each->addGqlTypes()
->map(function ($blueprint) use ($taxonomy) {
return compact('taxonomy', 'blueprint');
});
});