texts: How to synchronize the database upon team work on Drupal 8 project?

texts:
For example, there is being written a big project on Drupal 8 by several developers. They use Git for team working.

The first developer is creating some node types and adding some test nodes.
At the same time the second developer is creating some taxonomy vocabularies and adding several taxonomy terms.

At the same time the third developer is setting up search indexes for Search API.

After it they need to synchronize the database for continuing work.

I suppose that commiting, pushing and manually merging SQL dumps is not good idea.

Could you share your experience, how is the best way to synchronize the database after work ? Are there any good tools for it ?


texts:
I am trying to add a "number" field type to a form using FAPI:

$form['phone_number']['areacode'] = array(
  '#type' => 'textfield',
  '#title' => '---',
  '#width' => '30%',
  '#align' => 'center',
  '#required' => true,
  '#maxlength' => 3
);

I change the TYPE to "number" and the field doesn't get generated at all. The number module is enabled. I have implemented the following theme functions:

MYTHEME_form_element
MYTHEME_textfield
MYTHEME_container

What could be behind this field not showing up when I use #type = number or #type = number_integer, etc?

This might have something to do with it:

Creating Number fields (integer and decimal) manually in code for custom forms

However I actually want the type to render as "number" in HTML so smart phones show a numeric dialer

Any ideas?


texts: How to change the order of date module fields on edit by language?

texts:
By default, when editing a date field that includes day, month, and year, there are dropdowns displayed in day-month-year order.  This is good for English, but for users whose language is set to Japanese, I would like to show the edit dropdowns in year-month-day order.  Is this possible?

I'm on Drupal 7.

EDIT:
I attempted to edit the locale format but I wasn't able to get it working.

Under localize, I set the following values for Japanese:

I then confirmed that the field was set to display dates using the short format:

I then cleared my cache twice and reloaded.  However, the edit widget (a date field on the user profile registration page) still displays dates in day/month/year format for both languages.


texts: How to aggregate a views by only one field?

texts:
I have a views display that has two node ids: One is referrer and the other is the referenced.

I have only one case that the referrer make a reference to 2 other nodes. But when this happens I need to bring the referrer only one time with one referenced node, it doesn't matter which one of them.

Is it possible to do it? I tried with aggregate yes but without success.


texts: Is there a way to display webform submission based on element values?

texts:
I create a webform in Drupal 8 with certain elements (first name, last name, email, phone, visible (Yes / No)).
I want to display the results of the webform based on the element (visible = Yes), so that other roles cannot see the results where visible = No.
How can I do that? How can I filter webform submissions based on element values?


texts:
I'm relatively new to Drupal 7 and I'm a little lost on this one.

I have an "event" Content Type that contains a list field type that displays about five "location" options. Here they are, in key|label form:

Main Entrance|Main Entrance

School Entrance|School Entrance

Park Entrance|Park Entrance

Staff Entrance|Staff Entrance

What I'd like to do is directly link each label to a PDF file containing a map of the entrance location; e.g., Staff Entrance|Staff Entrance.

When I try to customize the field settings, Drupal tells me that the following tags are allowed in labels:   <big>
 <q>      <tt>

 . But in spite of my efforts to add tags to labels, Drupal changes them to HTML entities and ignores them; e.g., &lt;Staff Entrance&gt;. This is the case for all HTML tags.

Is there a reason HTML is not rendering in my labels?

Thanks!


texts:
I have a little module that I want to use to show a slideshow in a block, the module was created with the drupal console.

I added this code for the block :

/**
 * Slider homepage
 *
 * @Block(
 *   id = "slider_block",
 *   admin_label = @Translation("Slider (HP)"),
 * )
 */
class SliderBlock extends BlockBase
{
/**
 * {@inheritdoc}
 */
public function build()
{
    $view_builder = \Drupal::entityTypeManager()->getViewBuilder('slider');

    $ids = \Drupal::entityQuery('slider')
        ->condition('status', 1);
    $pids = $ids->execute();
    $slides = Slider::loadMultiple($pids);

    $build = [
        '#theme' => 'slider',
        '#slides' => $view_builder->viewMultiple($slides, 'full'),
        '#attributes' => ['class' => ['owl-carousel-wrapper'], 'id' => 'owl-carousel-hp'],
        '#attached' => [
            'library' => ['slider/owl-carousel'],
            'drupalSettings' => [
                'block-sliderhp' => [
                    'singleItem' => true,
                ]
            ],
        ]
    ];

    return $build;
}

/**
 * Définition du context de cache du block
 * @return string[] Context de cache
 */
public function getCacheContexts()
{
    return Cache::mergeContexts(parent::getCacheContexts(), array('url.path', 'url.query_args'));
}

public function getCacheTags()
{
    return Cache::mergeTags(parent::getCacheTags(), array('slider'));
}

}

My problem is about the view_builder->viewMultiple I want to render one by one my slider entity (which is called Slide), and then use these render in the slider template. So I have this hook_theme :

  function slider_theme() {
  return [
    'slider' => [
      'render element' => 'slides',
    ],
    'slide' => [
      'render element' => 'slide',
    ]
  ];
}

I can't manage to achieve what I want to do, the slide template is never called, and only the slider template is called. My preprocess function for the two are never called ...

And also if someone know about OwlCarousel, mine is not working well (the parameters are not passed).


texts:
Could you please explain how it works:

$form['support']['priority']['#type'] = 'value';

On my site this code is used to hide Priority field. But I don't understand the logic (I'm pretty new in Drupal). What is really this 'value'.


texts: How can I send HTML mail when a new content is created with attachments using these modules?

texts:
In my project, I need to send HTML mail when a new content is created with attachments using the Mimemail, Mail System, SMTP, and Rules modules.
Plain text mail is working fine with rules module but problem is with HTML mail.
Can you please tell me the procedure to configure Mail System and Mime mail with SMTP?


texts:
Trying to show just the images in a slideshow 'view'.
Not sure where to turn the title off, I've tried changing it to <none>,
but it's still printing out over the image. I even changed it under 'manage display' to hidden field and I'm unchecking the default option of creating a label.
Where do I need to adjust this at?


texts: Commerce- How can I track order details (products, quantities) in PayPal?

texts:
BACKGROUND

I have an online store.  Previously, I used PayPal "Buy it now" buttons, and I had a button for each product.  I would then periodically export the data from PayPal (download history as CSV) and it would have the following field/value pairs:

Item Title: Type of product (e.g., Nintendo DS)

Option 1 Name: Type of product (e.g., Nintendo DS)

Option 1 Value: Color (e.g., red)

Users were limited to ordering one item per order.  I used this information to analyze what are the top selling products/variations in the store in Excel, and I have a few years of historical data.

DRUPAL COMMERCE

I recently moved the store to Drupal Commerce, although I am still using PayPal for payment (PayPal Payments Standard/WPS) via the Commerce PayPal module.  This works very well, and users are still limited to one item per order.  However, when I export the transaction data from PayPal, it now looks like this:

Item Title: Shopping Cart

Option 1 Name: null

Option 1 Value: null

Is it possible to set the Item Title and options somehow during checkout with Commerce?  If not, how can I analyze my new sales data in Excel in a way that is (at least mostly) consistent with the years of PayPal exports I already have?


texts: Is it possible to make only one field in a content type language neutral?

texts:
If you have a text field, that you do not want to be translated (i.e. language neutral) as in a field for an email address, how do you set just that one field to be language neutral, while leaving the rest of the fields in the content type multilingual (enabled, with translation under workflow settings)? I've tried toggling the checkboxes under "Content Translation" but I think that's just for the Translation Management modules translation jobs handler, not for the actual field settings itself.

The idea is to not have to enter an email address twice in both, for instance, English and Spanish since the value will be the same in both language. Otherwise you have to enter the value in each language to get it to show up in that language.


texts:
i have created a navigation menu  like

home, services, about us, so on and then contact us .. each parent has many child and their own child . it was created sucessfully.

Now what i want to show  menu navigation on left side bar expect home and contact us .  but all menu is display as a header too.

i want to show only parent item. when i click on parent then it's child automatically open.

Is there is any module for this. Or their is any other way to achieve this

Thanks a lot


texts: How can I associate two entities to one another?

texts:
I have a custom entity which represents a laboratory sample. This entity contains a custom multi-value field (analysis) with CARDINATITY_UNLIMITED for all the analyses that are performed on this sample. This works great for most analyses, for example, I can record the information on a sample (lot number, date sample was taken, etc) and measure its ph, and record the method ('ph') the date of analysis, and the result. I can also measure the temperature of this sample and record the method ('temp'), the date, and result.

However, some analysis methods return multiple results. A GC can return the concentrations of hundreds of compounds in one run.
To represent this, I created a new entity called multi_analysis. This entity stores the method, the date, and a custom field. I also have an entity_reference to the sample that was analyzed. The custom field is CARDINATITY_UNLIMITED and lists the chemical name and the concentration for a specific multi_analysis.

I feel that, first off, I probably should move the entity reference to the sample entity with CARDINATITY_UNLIMITED, to make Widgeting simpler, despite the fact that this will create a new table.

If I did this, instead of using a entity_autocomple widget to find an existing multi_analysis entity in the sample addition form, is there a way to create a new multi_analysis entity within the sample entity admin page?

Alternatively, can I somehow make this multi-analysis a field and do the sample thing? Is it possible to have a field, which itself contains another field with CARDINATITY_UNLIMITED?


texts: Adding JS to a form within Omega 4 theme

texts:
I need to add some JavaScript to forms within my Omega 4 theme.  My code right now is:

function mytheme_preprocess_form(&$vars) {
    $vars['element']['#attached']['js'][] = 'path/to/myjs';
}

This isn't working, but it seems like it should.  I need to do this from my theme.  I don't want to use drupal_add_js(), since that's being deprecated.


texts: Can I map to Body Summary in Feeds Importer?

texts:
I'm setting up a Feeds Importer to pull in content form a previous CMS. To keep things manageable I'm setting up MySQL exports saved to CSV files per Content Type. In a content type of News we're using the Body for full content display and the Body Teaser for the views listing.

In the source CSV file I have two separate columns: one for Body Content and another destined for Body Summary.

But in the Mapping for Node Processor Feed Importer, I don't have an option to place the teaser column in Body Summary.

Follow up:

I did the dummy field option. Once I had that, three lines of SQL saved the day.

UPDATE field_data_body f, field_data_field_news_teaser_summary_holdin ff
SET f.`body_summary` = ff.`field_news_teaser_summary_holdin_value`
WHERE  ff.`entity_id`= f.`entity_id` AND f.`revision_id`= ff.`revision_id`


texts: Bad experience: PDF to ImageField and similar Drupal modules

texts: I can not make them work (PDF to ImageField, PDF Preview and PDFThumb), No errors, no status report messages. Simply it doesn't show the preview as it should.


texts: How do I change '|' to '-' in HTML page title?

texts:
I wan to change the HTML page title: It is displayed as "pagename | sitename"; I want to change it to "sitename - pagename."

How can I do this?


texts: Removing input formatting options and description from comment form

texts:
How do I remove the input formatting options and descriptions from the comment form?

I'm not interested in a CSS and/or jquery based solution, nor am I interested in using the Better Formats module, as I am using Drupal 7 and it specifically states it is not ready for production sites (besides the fact installing a module to do this seems like overkill).  I want the html sent over the wire to not have the "input format" related text at all.

Drupal drives me nuts sometimes, because some stuff that should be simple is ridiculously complex.

I've searched but no one seems to know how to do this. Here's some things I've found:

form_alter hide Text format option
Hiding the comment form's input format selector: A zombifying experience
Drupal 7 notes - Hiding unwanted form elements in comment forms


texts: How to display the related node content in a block?

texts: How can I display the related content for a specific node (type product) in a block? I would like to display the image, title and a trimmed body of the related content (from the same company) at the end of the node.


texts: Is there a way to change the vertical axis on FullCalendar to something else?

texts:
I'm using the FullCalendar module in drupal 7, and don't want time, kind of want categories on there instead, so you could set an event in a certain category on a certain day. Is there a way to do this in drupal? Or some other, even hacky way to do it?

Example: You want to set Phil to get his car fixed under the Time Off category(vertical axis) on Thursday, June 20th or something.


texts: Memcache not being cleared on cache flush

texts:
When clearing the cache, either through /admin_menu/flush-cache or drush cc all, the cache isn't cleared, without errors. I've tried doing it directly through telnet, on memcache, getting "OK" as result, but old pages are still being presented to users.

I am using the Memcache module 1.10; in the settings.php file, I added the following.

$conf['cache_inc'] ='sites/all/modules/memcache/memcache.inc';
$conf['memcache_servers'] = array(
  '127.0.0.1:11211' => 'sessions',
  '127.0.0.1:11212' => 'cache',
);
$conf['memcache_bins'] = array(
  'cache' => 'cache',
  'cache_form' => 'database',
);

Although the session bin is configured, it's not in use. I also have http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/ set up, tried using the "Flush this server" option, and get OK as result.


texts:
here is my code:

$nid = $entity->field_empf_number['und']['0']['nid'];
$result = db_query("SELECT MAX(entity_id) FROM field_data_field_empf_number WHERE field_empf_number_nid = $nid")->fetchField();
if (isset($result)){
  $n = $result ;
  $node = node_load($n);
  $node->field_empf_stat['und']['0']['value'] = 'off';  //list field
  node_save($node);
}
$entity_field[0]['value'] = $result;`

when add new node (if there is previous node i mean the if statement return true ) this error message show up:

  Fatal error: Maximum function nesting level of '100' reached,
  aborting! in C:\wamp\www\finance\includes\database\database.inc on
  line 429

I googled but i did not found any answers.


texts: Create Drupal 7 Multi Site on Mac OSX 10.10

texts:
I want to create a Drupal Multisite so I can share my theme and users between two sites. I want to set it up locally before I upload it on a webhost.

I am using Mac 10.10. However, many of the tutorials seem to be written for older versions of Mac OSX and don't work properly.

For example, this tutorial suggests the following:

Edit /etc/apache2/http.conf to add the following:

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/YOURSITE/Sites/drupal
ServerName drupal1.localhost
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/YOURSITE/Sites/drupal
ServerName drupal2.localhost
</VirtualHost>

Then edit  /etc/hosts to add the following:

127.0.0.1     drupal1.localhost
127.0.0.1     drupal2.localhost

You can now find your site at: http://drupal1.localhost & http://drupal2.localhost

When I do this, I just get the message "It Works" I am unable to go to the Druapl installation page to start installing the site.

I've had a search for other tutorials, but they all seem to be written for MAMP.

How can I fix it, without using MAMP?


texts: Migrating into a taxonomy and mapping terms based on their IDs

texts:
I'm working on a migration from a CSV into a Drupal 8 site, creating School nodes that include an entity reference field for a Sport taxonomy. The new taxonomy terms I want to use all exist within Drupal already, but they're nested such that a sport ("Basketball") is listed as a parent term, with child terms ("Boys" and "Girls") below them. Because the child terms' names are the same under multiple sports, I'm attempting to target the mapped destinations by their term IDs instead.

Here's an example of what I've tried – this looks similar to a previous answer and produces no errors, but also no Sports mappings. Other tweaks I've made have resulted in either the original terms ("Basketball Men") being imported as new terms or the importer producing errors because those terms aren't IDs.

source:
  plugin: csv
  path: sites/default/files/data/schools.csv
  delimiter: ','
  enclosure: '"'
  header_row_count: 1
  keys:
    - id
  column_names:
    -
      id: 'Unique ID'
    -
      sports: Sports
process:
  field_sports:
    -
      plugin: explode # Because schools have multiple terms...
      delimiter: ',' # ...separated by a comma in the spreadsheet
      source: sports
    -
      plugin: static_map
      source: sports
      map:
        'Basketball Men': 37 # Corresponds with the ID for Basketball > Boys
        'Volleyball Men': 74 # Corresponds with the ID for Volleyball > Boys
        'Volleyball Women': 75 # Corresponds with the ID for Volleyball > Girls
        [...]
    -
      plugin: entity_lookup
      value_key: tid
      entity_type: taxonomy_term
      bundle_key: vid
      bundle: sport # The ID of the taxonomy vocabulary

Is there an obvious adjustment I need to make in order for these terms to import properly?


texts: Matching user accounts in views with taxonomy

texts:
In user accounts we have two Term fields that use the same taxonomy vocabulary. For example, the user profile has I need and a I have fields.

For example User A has a blue crayon but wants a red one.

- I have
-- X Blue Crayon
-- - Red Crayon
-- - Green Crayon
- I want
-- - Blue Crayon
-- X Red Crayon
-- - Green Crayon

I would like to craft a view that, based on User A's desire marked want, finds all users that have Red Crayon they want to lend.

Ideally, I'd like to auto populate this contextual filter with what the logged in user has specified. For example in this situation, I want to populate When the filter value is not in the URL's Provide Default Value field with the term_id of Red Crayon. Thus, listing everyone with ready to lend a red crayon.


texts: How do I programmatically change settings to simplify sharing of config changes?

texts:
I'm thinking specifically here of layout changes, such as:

moving a block around, or
when a new block is created and needs to be positioned, and shown or hidden on specific pages.

Currently, when somebody makes layout changes using the admin menus, we all have to go through the same process by hand. My issue with this is that it's time-consuming and error prone.

In an ideal world, I would love to have a system that is able to transfer someone's updated config changes to my local site.

Is this possible?


texts: Increasing width of Views 3 search form filter

texts:
I am trying to increase the size of my views search filter form. The form id is views-exposed-form-blog--user-s-tab--page and am trying to use this in code I've used for my search block but its not working.

Here's my search block code -

function Themename_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'search_block_form') {
    $form['search_block_form']['#size'] = 26;
  }
}

Any ideas how I can make this work?

Thanks in advance


texts: Render scald atom with image style, without new scald context?

texts:
We have a field or type "Atom Reference", that references scald images.
I want to render these in a node display, using an image style.
For this we need a formatter that will render the scald atom with this image style.

The way we currently do this:

Create the image style.
Create a scald context, and configure it to use a "transcoder" based on this image style.
Use the scald context as a formatter in "manage display" for the node view mode.

This means, we need to create a separate scald context per image style.

What I would prefer is to have just one formatter, and then choose the image style in the formatter settings. Maybe with a "flexible" scald context, and then let the formatter alter this context programmatically.

Does something like this exist?


texts: Error programmaticaly adding image to node using file_copy

texts:
I am trying to add an image to the article content type in Drupal 7, When I create a simple note i.e. article it works , but when I try to add the image to the article it gives an error

  The specified file
  E:\WS_IntPOC_Test4\sites\all\modules\my_module\errorwinmobilesdk.jpg
  could not be copied, because the destination is invalid. More
  information is available in the system log

In log I can see the message as

  File
  E:\WS_IntPOC_Test4\sites\all\modules\my_module\errorwinmobilesdk.jpg
  could not be copied, because the destination is invalid. This is often
  caused by improper use of file_copy() or a missing stream wrapper.

I have checked the wrapper public and private is there. As if I created the Article from GUI. It is created with image loaded in public folder. Please help

$body_text = 'node body text';

  $node = new stdClass();
  $node->type = 'article';
  node_object_prepare($node);

  $node->title    = 'Node Created Programmatically on ' . date('c');
  $node->language = LANGUAGE_NONE;

  $node->body[$node->language][0]['value']   = $body_text;
  $node->body[$node->language][0]['summary'] = text_summary($body_text);
  $node->body[$node->language][0]['format']  = 'filtered_html';

// Some file on our system

$path ='E:\WS_IntPOCTest4\sites\all\modules\my_module\errorwinmobilesdk.jpg' ;
$file = (object) array(
          'uid' => 1,
          'uri' => $path,
          'filemime' => file_get_mimetype($path),
          'status' => 1,
 );

//$file = file_copy($file, 'public://'); // Save the file to the root of the files
$file = file_copy($file);
$node->field_image[LANGUAGE_NONE][0] = (array)$file;
//associate the file object with the image field:
node_save($node);


texts: What is the correct way to set cache contexts on custom blocks?

texts:
I have run into an issue where a block that should be unique per page isn't for logged-out users.  The issue is a custom block plugin I have on a views search page that contains custom filters (sort of like a custom replacement for exposed filters. the block placed through /admin/structure/block).

Based on what I have learned about Drupal 8, I added the cache contexts to my build array:

  public function build() {

    $search_form = \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\SearchForm');
    return [
      'search_form' => $search_form,
      '#cache' => ['contexts' => ['url.path', 'url.query_args']]
    ];

  }

But it seems this must be incorrect because when logged-out, the block would get cached on the first view, and when the url changed, it wasn't showing a new version of the block.

I thought it might be the view page that was causing the issue, but even when I turned caching off on the view page, the issue remained.

I was able to fix the issue several ways, for example, by using a preprocess_block hook:

function mymodule_preprocess_block__mycustomsearchblock(&$variables) {
  $variables['#cache']['contexts'][] = 'url.path';
  $variables['#cache']['contexts'][] = 'url.query_args';
}

But it bothered me I couldn't just put the cache contexts into my block's build array.

Since my block extends BlockBase, I decided to try out the getCacheContexts() method, especially since I saw some modules within core are doing it this way.

  public function getCacheContexts() {
    return Cache::mergeContexts(parent::getCacheContexts(), ['url.path', 'url.query_args']);
  }

This is also fixed the issue, but interestingly, when I output the variables in the preprocess block function, these are not showing in $variables['#cache']['contexts'], but they do show in $variables['elements']['#cache']['contexts']

array:5 [▼
  0 => "languages:language_interface"
  1 => "theme"
  2 => "url.path"
  3 => "url.query_args"
  4 => "user.permissions"
]

I'm trying to figure out how this works, and why it wasn't working from the build function.

Looking at /core/modules/block/src/BlockViewBuilder.php at the viewMultiple() function, it looks like it pulls the cache tags from the entity and the plugin:

'contexts' => Cache::mergeContexts(
  $entity->getCacheContexts(),
  $plugin->getCacheContexts()
),

So that explains why adding a getCacheContexts() method to my block plugin adds the contexts to my block.  Also, looking at the preRender method in the same class, it looks like it doesn't use the cache array in the blocks build function, which confuses me, as it seems the way to add caching in Drupal 8 is to add a #cache element to render elements.

So my question is,

1) Are cache contexts added directly on the array in a block plugin ignored?

2) If so, is there a way around that, do we need to add it to a child element of the build array?

3) If context added directly is ignored, is adding a getCacheContexts() the way to go for block plugins in custom modules?


texts:
I am creating REST API using Services Module in Drupal 7.

I have created a View to Get lists of Groups. In this views, I have added a Field privacy which will tell if the group is Private or Public.

I am getting this Output if group is Private:

privacy":{"value":"1"},

and if the group is Public :

"privacy":[]

How can I edit the output of this field so that it become easier for app developer ? I want to have something like this in output :

For Private : privacy":{"value":"1"},
For Public  : privacy":{"value":"0"},

Or something like this which look good.


texts:
I've got two fields in my form which are called geographicarea and specialty.

I'd like to use these values in an SQL query when the form is submitted.

How can I do it?


texts: How do I create a configuration sync folder?

texts:
I've inherited a Drupal 8 site but it has no config_HASH folder with it which means that the majority of admin paths throw an exception.

How do I generate a new configuration folder based on the current site?


texts: Login to Drupal website from external website through Webservice module

texts:
I have a drupal website say www.example.com I have created a REST service service1 using service module.
So i am able to authenticate the user by posting post data username and password to www.example.com/service1/user/login using a form from external site

After after clicking submit from external website, the page remains at http://example.com/service1/user/login with blank page

Now what i want is to redirect the user to home page www.example.com after successful authentication


texts:
I don’t know why most of my parent terms have duplicate URLs:
One like this:

     taxonomy/term/1

And a second one like this:

     taxonomy/term/1/0

I have installed Global Redirect and Pathauto, and all urls in the first format are redirected to their alias. However urls in the second format are not.
Now google is reporting a large list of duplicate title tags. How can I solve this?


texts: I added a footer to a view and I need to give this footer a wrapper class or id. How can I accomplish with this?


texts: page--front.tpl.php not showing up in Zen subtheme

texts:
I am developing a subtheme of a Zen-based subtheme. I have created a page--front.tpl.php template but it isn't being recognized. All I see is the page.tpl.php template being used for the front page.

I have cleared the cache multiple times, looked for any other page--front.tpl.php files in the subtheme I am basing mine off of (there are none). I have restarted apache to make sure nothing is being cached, so I am at a loss as to why this is not working. I am using Drupal 7 on a linux server.

Any ideas as to what may be causing this issue? I have googled similar problems but most had to do with clearing the cache (which I have already done).

Using Theme developer, it shows that page--front.tpl.php is not a canditate template to use. In fact it doesn't show any candidate templates that could be used while on the front page of the site.

Thanks.


texts:
I'm having some trouble finding how to handle field translations in the documentation.

I have a requirement to keep certain fields in English and Japanese. I periodically have to update nodes and taxonomy terms programmatically. I'm doing this with a combination of EntityQuery and the Entity class.

Is there a set function that takes a language code? For example;

$term->set('field_my_field', 'my value', 'ja');


texts: Rules custom action - how can I get the name of just created account

texts:
I am writing custom Rules action which is supposed to create new instance of a field in database. Action triggered on "new account saved"

I need the field to be labelled as the name of just created account.

Tried to use $account->name but the $account variable seems to be empty...

How can I get that name into the action???

Thanks :)


texts: entity reference as attribute, is it possible in commerce v2?

texts:
User story:
The end-users should be able to pick an image from an image gallery and attach that image to a product before adding it to cart

In Commerce v1 this was possible via line items by defining an entity reference field, along with a couple of other modules e.g. entityreference view widget. A sample, although not 100% finished, can be found in d7demo when you click on the 'add item' button.

I used entity reference since the images are actually nodes with a file field, so that i could also categorise them via term references.

Is the above functionality somehow possible on commerce v2? I cannot find  'line items' as used in v1, but only attributes and variants. However i cannot seem to find the way (configuration or contribs) to achieve the above functionality.

Any pointers to the above issue are very much appreciated.


texts: Get entity id in hook_form_BASE_FORM_ID_alter()

texts:
I am working on porting a D7 module to D8.
As in Drupal 8 all things are represented as entity, menu items are also represented as entity.
Now I added a hook_form_BASE_FORM_ID_alter() implementation to alter the menu creation and edit form. On the menu edit form, I want to get the entity ID of the menu that is currently being edited.

I tried to get the entity id ID with the following code, but I am getting an error. (See line 43.)

$entity = $form_state['controller']->getEntity();

For above snippet I followed https://www.drupal.org/node/1734556.

How can I get the entity ID?


texts: SearchAPI + FacetAPI: Expose operator to user (AND/OR)

texts:
In our project we have a requirement to exposed facet operator to user. On front end, user will see a bunch of facets and for each he will be able to select AND/OR operator. I'm looking for a way how to implement this.

I guess for this I would need to create custom widget for each facet to include AND/OR operator switcher. But I have no idea how to pass this operator to search_api/search_api_solr. Does facetsa allow operator to be set in GET parameter?

Current setup:
- search_api: 7.x-1.14
- facetapi: 7.x-1.5
- search_api_solr: 7.x-1.6

Any suggestions?

Thanks in advance!


texts:
I wanna add in a block configuration form an image field that can take several images, just like in a node form, with all the drag'n drop stuff, etc.
Any advices or solutions?


texts: 'You must declare "ids" as a unique array of fields in your source settings'

texts:
I am trying to learn about importing images with migrations using this tutorial and this custom module (c11n_module). When I install and try to run 'drush ms' I keep getting an error.
In CSV.php line 105: You must declare "ids" as a unique array of fields in your source settings.

The id looks like this:
keys:
  - ID

The helper thought I found shows this:
ids:
  id:
    type: integer

However, if I change to this:
ids:
  keys:
    - ID

I still get the error. I have spent a few hours trying to figure this out. I am assuming it is in the YML file that I have to correct this. Any ideas for solving this issue?
Or am I thinking about it all wrong?
Here is the whole YML:
# Migration file for creating "image" for academic programs.
#
# Detailed explanations for various elements of a migration
# YAML have been provided in migrate_plus.migration.program_data.yml

id: program_image
label: Image associated to academic programs.
migration_group: c11n
migration_tags:
  - academic program
  - file
  - image
# Source.
source:
  plugin: csv
  path: 'public://import/program/program.data.csv'
  header_row_count: 1
  ids:
    keys:
      - Image file
  # Source field definitions.
  fields:
    Image file: Name of the image file associated with the program.
  constants:
    file_source_uri: public://import/program
    file_dest_uri: 'public://program/image'
# Destination.
destination:
  # We will be creating entities of type "file" this time.
  plugin: 'entity:file'
# Mappings.
process:
  file_source:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_source_uri
        - Image file
    -
      plugin: urlencode
  file_dest:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/file_dest_uri
        - Image file
    -
      plugin: urlencode
  filename: Image file
  uri:
    plugin: file_copy
    source:
      - '@file_source'
      - '@file_dest'
# Dependencies.
dependencies:
  enforced:
    module:
      - c11n_migrate


texts:
I installed Debian 7 in a VM, there is nothing there except for web server apache2, mysql, webmin, phpmyadmin, and drush.
Drush fails to install Drupal, gives me admin and password but it fails to log me in.
Error: Not Found
The requested URL /phurst/node was not found on this server.
Apache/2.2.22 (Debian) Server at xx.xx.xx.xx Port 80
Weird thing is that it works flawlessly on my localhost, my computer is more advanced, I use Debian testing branch in it.
I cannot figure out what is causing this, I added my user to group www-data, chowned web root (/var/www) to myuser:www-data.
I noticed that perms were not set, that is weird because drush set perms correctly, I set all perms on the site to 775 recursively, but I am still locked out of the admin area.
Another weird thing: I can install Drupal manually, but I need to use drush to go fast.
Thanks in advance.


texts:
I am having a problem with multilingual settings. Here is my site URL http://centriumcapital.com/centrium. Everything is working fine but I just want when someone requests http://centriumcapital.com/centrium the default language should be French and also content of the home page also should in French.

I added code in settings.php file to make French language as default language it selects the French language as default but content is still from English language.


texts: How to create rule to redirect an admin after log in to an admin specific node?

texts:
I have different roles for users of my Drupal 7 site. I have added a rule that whenever an authenticated user logs in they are directed to a node (say node/90). This works fine: both admin and authenticated users are redirected.

However I want that the admin be redirected to a different node say node/25. So I added a new rule and selected under condition that user role is administrator and in action also forced a redirect. However the admin still redirects to node/90. Why so and how can I achieve my use case?

As suggested by NikhilM, I have created a custom module for it and the .module file has

    <?php

function redirect_ad_help($path, $arg) {
  switch ($path) {
    case "admin/help#redirect_ad":
      return '<p>' . t("Redirect") . '</p>';
      break;
  }
}
function redirect_ad_user_login(&$edit, $account) {
 if($account->uid == 1)
  drupal_goto('node->97');
 else
  drupal_goto('node->69');
}

I also tried doing $edit['redirect'] = 'node/97'; instead of drupal_goto() but I am taken to the home page only and not to the desired node.


texts: Why do we have signed integers for timestamps in core with 2038 timestamp date bug in mind?

texts:
So I couldn't find a Drupal specific documentation about this, and I know this is far off into the future, but it seems to me the way we currently use timestamps in Drupal will invoke the 2038 bug right about when our kids graduate college.

I hope I am missing the obvious here, but looking at node table for example all created and updated timestamps are not 'unsigned' integers. According to this SE post and this mysql issue having timestamps as unsigned integers kicks the ball down the road for several generations till 2116 (when I assume there won't be a need for CMS because we will all know everything) so... shouldn't we be using unsigned integers?


texts: publish article to home page and secondary page

texts:
I am a joomla convert.  With my old website on Joomla I could publish an article to a specific page as well as the home page.  It would remain on the home page until it was "pushed down" by new articles, but would always be on the specific page in a back up sort of way.  I want to do that here are well.. Let me be a bit more specific...

I have officers at my work place that want to put reports on the website on occasion. When the President posts a report it will post on the front page but also the president page.  I have created a President page on Drupal (7) yet I can't get an article to post to it AND the front page.  I asked this question on another forum and I was rudely directed to look up Taxanomy, which I did and I'm still lost.

Can someone please just direct me to what I need to do to have an article appear on the president page and the home page?

Thank you...


texts: add js by #attached - hook_page_alter in theme's template.php

texts:
I am trying to add js by #attached, as I understand it's better from a caching perspective then drupal_add_js(). I try to use hook_page_alter() in template.php.
I have the following code:

function mytheme_page_alter(&$page) {
 $theme_path = drupal_get_path('theme', 'mytheme' );

  if (!isset($page['content']['#attached']))
    {
      $page['content']['#attached'] = array
      (
        'js' => array(),
      );
    }

  $page['content']['#attached']['js'][] = array($theme_path . '/test.js');
}

(this is adapted from http://www.jaypan.com/tutorial/including-javascript-or-css-files-every-page-load-module-drupal-7, I first tried to attach [#attached] directly to $page by means of  $page['#attached'] = array... , but as I faced the problem described below I tried to test some code suggested by other people).

The problem is that the elements of the js are not properly set. After the 'js' => array(), The Aptana Debugger shows what I'd expect :

After $page['content']['#attached']['js'][] = array($theme_path . '/test.js'); , however, the array values are not set:

Still the value of array($theme_path . '/test.js')is what it 'should' be:

It's as if the ascription did not go through.
What did I do wrong?


texts: Remove the ability to import previous imported file

texts:
I'm guessing someone must have done this before but I can't find a module for it.

In Feeds the last file you imported can be seen by name on the left hand side.  Next to the 'Browse' box.

If the user doesn't browse for a file then the File shown in that box is imported when clicking on the 'submit' button.  What I'd like to do is to leave this file being shown as the last import but I don't want it to be imported if no file has been selected.

Has anyone done this or something similar .


texts: I have my gmap working fine. When i click on the pointer in gmap, i need to open the address in a popup outside. I may use anything i.e colorbox or lightbox. Is there already any integration available.


texts: Form API Ajax - how to disable also form elements that will be changed, not only triggering element?

texts:
So, element that triggered AJAX gets disabled. But how to make Drupal also disable everything inside ['#ajax']['wrapper']? After all, allowing user to edit something that will get replaced as soon as AJAX response is ready isn't the wisest idea, and I'd like to prevent that. And my AJAX created elements have their own AJAX too, race conditions are pretty bad already.

Is there any ready-made module for that? Or API way I'm missing? If no, where exactly should I put that code to minimize risk of incompatibilities?

Edit: I'm looking for a safe and stable way. It means no hard-coded identifiers in JavaScript files. Solution that breaks when someone edits form definition, or one that works for only one AJAX in form is not enough. After all, I need to avoid race conditions, and I already noted I have multiple AJAX actions, working on different sets of elements, on one page - so no marking elements for disabling at PHP level. I can eventually mark them with classes like disable-on-X and disable-on-Y, but I need to know if it's X or Y AJAX happening. And ideally I'd just disable everything inside ['#ajax']['wrapper'] without any additional marks, as they are not really needed - but again, I would need to know proper ['#ajax']['wrapper'] in javascript.


texts:
In the examples modules I see a simple example of tableSort with one table.
Searching online I find a post where they claim Drupal 7 allowed a db_select() object to be created and then extended it with a join(), and then the final ->extend('TableSort');

https://www.drupal.org/forum/support/module-development-and-code-questions/2011-12-15/dbtng-tablesort-with-joins-any

I need to do an innerJoin() which appears to be a method of the SelectQuery class, and not necessarily a method of the Tablesort class. That's why the docs I see about extenders say it's critical to invoke the TableSort in the instantiation of the db_select object. Thus, my attempt:

$get_all_members = db_select('users', 'u')->innerJoin('members', 'm', 'u.uid = m.uid')->extend('TableSort');

  Call to a member function extend() on string

is the response. Is there a way to convert a db_query into a TableSort object like it appears the extender is doing?

Or, could I find a way to combine the fields I need in these two tables to pass to the TableSort object?


texts: How to delete uninstalled modules via drush?

texts:
I have been wondering how one could clean up uninstalled modules in the modules folder. Perhaps by piping some drush output to rm rf...

I noticed drush pm list gives small modules that exist in larger enabled modules. Any tips?

drush pm-list --type=Module --no-core --status="Not installed"


texts:
I have field collection. The problem is that one field is depended on select list.

When I choose type "job" from select list then company field should be required for that collection. Otherwise company field should be completely omitted in validation.

Update:

I tried to add my own constraint validator but with no effect and I don't have errors on that.

function job_market_user_entity_bundle_field_info_alter(
  &$fields,
  \Drupal\Core\Entity\EntityTypeInterface $entity_type,
  $bundle
) {
  if ($entity_type->id() == 'field_collection_item') {
    /* @var Drupal\field\Entity\FieldConfig $company_field */
    if ($bundle === 'field_jmu_working_experience') {
      $company_field = $fields['field_jmu_company'];
      if ($company_field) {
        $company_field->addConstraint('JobTypeConstraint');
      }
    }
  }
}

Constraint

namespace Drupal\job_market_user\Plugin\Validation\Constraint;

use Drupal\Core\Annotation\Translation;
use Drupal\Core\Entity\Plugin\Validation\Constraint\CompositeConstraintBase;
use Drupal\Core\Validation\Annotation\Constraint;
/**
 * @Constraint(
 *   id = "JobTypeConstraint",
 *   label = @Translation("Job Type", context = "Validation"),
 * )
 */
class JobTypeConstraint extends CompositeConstraintBase {

  /**
   * @var string
   */
  public $message = 'Company field is required for Job working experience';

  /**
   * {@inheritdoc}
   */
  public function coversFields() {
    return ['field_jmu_type', 'field_jmu_company'];
  }
}

Validator (I added violation just to check if it's invoked - no effect yet)

namespace Drupal\job_market_user\Plugin\Validation\Constraint;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

/**
 *
 * Supports validating company depended on job type
 */
class JobTypeConstraintValidator extends ConstraintValidator implements ContainerInjectionInterface {

  /**
   * Validator 2.5 and upwards compatible execution context.
   *
   * @var \Symfony\Component\Validator\Context\ExecutionContextInterface
   */
  protected $context;

  /**
   * {@inheritdoc}
   */
  public function validate($entity, Constraint $constraint) {
    $this->context->buildViolation($constraint->message)
      ->atPath('field_jmu_company')
      ->addViolation();
    return;
  }

  /**
   * Instantiates a new instance of this class.
   *
   * This is a factory method that returns a new instance of this class. The
   * factory should pass any needed dependencies into the constructor of this
   * class, but not the container itself. Every call to this method must return
   * a new instance of this class; that is, it may not implement a singleton.
   *
   * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
   *   The service container this instance should use.
   *
   * @return static
   */
  public static function create(ContainerInterface $container) {
    return new static($container->get('entity_type.manager')->getStorage('user'));
  }
}


texts: Nightly truncating all cache_* tables? Good or bad?

texts:
I'm having some issues on various D7 sites with some cache tables growing stupidly large (e.g cache_metadata or cache_menu) which then makes drush cc all very slow (more than 1 minute).

Do you think that there is any problem if I setup a nightly linux cronjob which will be truncating cache and cache_* tables apart from cache_form? And after that I plan on executing a drush cc all for safety.

p.s I do not plan on investigating and trying to fix the root cause that makes those tables grow large.


texts: Ubercart Node/Product Field access to Role and purchaser

texts:
I have an Ubercart ecommerce Drupal 7 site I'm building.  The user can either subscribe (monthly/annually) or purchase node by node (pay as you go).

I need to GRANT the subscriber or purchaser access to the main body field of the product node only, as teasers and image fields etc will be used elsewhere on the site. (This rules out a few node_access options)

I would like to combine the permissions in my own custom module, as the I can't see any contrib permissions modules that fit my needs. e.g. Node access product.

Is there an simple custom way to ALLOW access to a field after I have checked if the user has:

a) Purchased this node, or
b) is a subscriber with access (I'm using uc_recurring for ROLE assign on purchasing a subscription).

I think it could due done manually in a module checking directly for current logged in users role(s) and purchases (nid's) and seeing is the logic plays out, but will this be slow on performance when there are 1000's users and 1000's products?

Please let me know if you need any more information or if I'm on the right track.


texts: Performance of group module with thousands of groups

texts: I am planning to make use of the group module and let site users create and maintain their own groups. This will lead to thousands of groups. I am wondering whether site performance would become a serious issue for Drupal maintaining that many new fieldable entities? I'm using Drupal 8.3.2


texts: Entity difference between fields defined in the entity itself and the external fields

texts:
When defining an entity (using e.g. Drupal console) some fields are created in the entity, these fields are stored in the entity-table. Afterwards you can add fields to an entity, these fields are stored in separate tables.
I see that in the entity-source you can add fields later on.

What is the difference between 'internal' fields and 'external' fields??


texts:
I installed Drupal 8 on a server and I'm trying to move all my content to a different installation with a different UUID. Since the installations have different UUIDs, I am not able to use the content synchronization module.

What should I use to transfer  the site content to a different site? Would changing the site UUID work? If the answer is yes, how should I do it?


texts: Why are responses for AJAX POST calls in admin UI so delayed

texts:
Just in the past day or so, something has happened to my site.

For some reason, all AJAX calls from Drupal's admin UI are now taking about 50 seconds a piece.

This is absolutely maddening because there are so many areas in Drupal's admin where one field change will result in an ajax callback.

I've been reviewing my network traffic in Chrome Dev Tools and Firebug and see that all pages and site resources are loading at an average of .2 seconds to 1 second.

Then, when I trigger a Form update in the UI, the POST to /system/ajax takes about 50 seconds

The same is true in /ctools/content/ajax/* -- when I am in the Panels screens, AJAX callbacks are averaging around 50 seconds of wait time for the server to respond.

I'm on a shared AN Hosting environment, D7.

Any thoughts?

EDIT --

I've found that some smaller AJAX requests (particularly those made by Inline Entity Form) do make it through without the delay... I can't see any correlation or pattern between those that do and then those that don't get through.  It can't just be one module as I see problems with core Fields UI's and cTools that are totally separate from eachtother

EDIT --

The consistency between failing calls seems to be the size of the POST -- even the basic Field UI has a post size of 252B -- smaller posts seem to not have an issue.


texts: How do I get the video media path in a theme?

texts:
I want to embed a video on a page.
How do I display the field_media_video_embed_field in my twig?
The complicated thing about this is that I am using a view inside tabs.
{{ kint(programme.video) }} gives me the following output.

In my theme I have used the following code.
$programmes = [];
$view = Views::getView('participating_programmes');
$view->execute();
foreach ($view->result as $row) {
  $video = $row->_entity->get('field_pvideo')->referencedEntities();
  $programmes[$nid]['video'] = $video;
}

Ideally I want to embed the video, but I would be happy if I could just get the field_media_video_embed_field and work from there.


texts: Feeds: Is it possible to set a unique field other than the title field?

texts:
I'm trying to create a feed importer that uses a unique ID that is NOT necessarily in the title field of the content type. For example, were I using the feeds importer to import a list of contacts, I'd like to have the unique ID be the phone number, yet I would prefer that the content title be the name of the contact rather than the phone number, for organization and aesthetic purposes. Is this possible? As of now, it seems I am limited to enabling only the title field as unique.

I realize I could simply put the contact name into the title field and set that as unique, but this is less prudent, as contacts may have identical names and similarly with my data, the duplicity of titles and/or misspellings is/are inevitable. Any help would be appreciated!

Thanks!


texts: I want to execute PHP script in my custom module, when transition occurs. Workflow is assigned to custom entity. I'm using Drupal's core modules Workflow and Content moderation. How can I do that programmatically?


texts: Installed Bluez theme as a sub-theme but can't change Appearance Settings

texts:
I'm using the Bluez theme (in D7). I created a sub-theme from it. It doesn't have a starter kit or anything so I just turned it into a sub-theme by creating an .info file, etc.

Things are working fine so far, but when I try to make any changes to the settings in 'Appearance' under 'Bluez Theme Settings' ... make the changes and then click 'save configuration' > it says the 'configuration options have been saved' but ... they aren't.

Any idea what might be happening here? I'm thinking maybe there are template files I should be copying over to my sub-theme folder or something. Or maybe you can't create sub-themes out of themes that don't support sub-theming?


texts: How to add more than 7 links in the shortcuts bar?

texts: I just noticed that there is a limit of links to add to the Shortcut bar. Is there any way to change this, I need no limit at all.


texts: How can I avoid saved configuration settings to be exported?

texts:
I have a custom module and I added a form that allows the administrator to save some settings. Now, when I export the configuration (drush cex), I notice that these settings are being exported to a file (mymodule.settings.yml in the config directory).

I don't want to export these settings. How can I avoid it?


texts: Difference between $this->config and \Drupal::config in ConfigFormBase

texts:
I want to override a custom module configuration in the settings.php file. So the configuration in database can be independent from the environment.

$config['my_module.settings']['prop'] = 'foo';

I my module configuration form, the config result is different given the method I use to get it :

class MyConfigurationForm extends ConfigFormBase {

    public function buildForm( array $form, FormStateInterface $form_state ){
        $config = $this->config( 'my_module.settings' );
        print_r( $config->get('prop') );
        // prints database value, or nothing if there is no value in database for 'prop'

        $config = \Drupal::config( 'my_module.settings' );
        print_r( $config->get('prop') );
        // prints 'foo'
    }

}

Why is that ?
What's the difference between these two methods ?


texts: Drupal simplenews doesn't subscribe the users registed via social networks

texts:
I'm using Simplenews module for sending newsletter to the registered users. When a user creates a new account he/she will be automatically subscribed to a newsletter which can be seen in admin/people/simplenews.

However, when user registers via social network he/she is not subscribed to newsletter. When I visit admin/people/simplenews I can see only the users registered in normal way; users registered through a social network cannot be seen.

I'm using HybridAuth for Twitter & Google+ login and Fboauth for Facebook login. In simplenews configuration, I've used silent setting. What can I do to make users sign up to a newsletter on social network registration?


texts: Creating a custom views filter handler with a non-sql query

texts:
So, I'm working on a custom views handler that will allow users to filter based on field comparisons.

I've overridden the operator to use my own function defined elsewhere in the module that implements hook_options() that is also used in rules.  I'm trying to guess at an appropriate way of building the query.

The example provided in the default compare_fields class that I'm extending does this:

  $snippet = $left_table_alias . '.' . $left_handler->real_field . ' ' . $this->options['operator'] . ' ' . $right_table_alias . '.' . $right_handler->real_field;

  $this->query->add_where_expression($this->options['group'], $snippet);

But I'd prefer to use a function I've already defined elsewhere that, instead of using a WHERE clause, will compare two fields with an operator to determine whether a TRUE value is returned from a geophp GEOS method.  The function is as simple as this:

function geofield_rules_compare_geofields($left_geometry, $op, $right_geometry) {
$geophp = geophp_load();
$source_wkt = geoPHP::load($left_geometry['geom']);
  if (!$geophp) {
    drupal_set_message(t("Unable to load geoPHP library. Not all values will be calculated correctly"), 'error');
    return;
  }
  if (geoPHP::geosInstalled()) {
      switch ($op) {
      default:
      case 'contains()':
        if ($source_wkt->contains($right_geometry)){
          return true;
        }
      case 'within()':
        if ($source_wkt->within($right_geometry)) {
          return true;
        }
    }
  } else {
    dpm('shit, no GEOS');
  }

  // TODO: More methods
}

The operators used in the case statements are provided by the function I already mentioned.

How would you go about implementing the views handler filter query in this case?


texts:
Previously I'm using combination of cURL and sed to submit to Drupal 6 website. It was very flexible but it will works if I submit very frequently. If I want to submit 2 posts in one week, it will fail because of unique number generated in Drupal system over time.

I need to know any ways (drush or any other commands) that allow me submit new post easily


texts:
I'm trying to use "#states". When my checkbox is true, I want to make "required" another field. Drupal prints the "required" asterisk but not correctly.

Here it's the code:

  // Return origin.
  $form['search']['return']['return_ori'] = [
    '#attributes'    => [
      'class'       => ['field-autocomplete', 'ret-ori-name'],
      'data-type'   => 'busstop',
      'placeholder' => t('Write your origin', [], ['context' => 'Backend']),
      'required'    => TRUE,
    ],
    '#default_value' => !empty($_GET['return_ori']) ? $_GET['return_ori'] : '',
    '#prefix'        => '

',
    '#states'        => [
      'required' => [
        ':input[name="search_return"]' => [
          'checked' => TRUE,
        ],
      ],
    ],
    '#size'          => 40,
    '#suffix'        => '
',
    '#title'         => t('Return origin'),
    '#type'          => 'textfield',
  ];
// Return trip.
  $form['search']['search_return'] = [
    '#default_value' => !empty($_GET['search_return']) ? $_GET['search_return'] : FALSE,
    '#prefix'        => '

',
    '#suffix'        => '

',
    '#title'         => t('Search return trip'),
    '#type'          => 'checkbox',
    '#attributes'    => [
      'class' => ['search-return-trip'],
    ],
  ];

The submit button has not specific method, so Drupal should handle it. When I press it, the form is sended ignoring my new required field.

Thanks all for help!!


texts:
I downloaded a couple of module updates. Before I did so, I didn't disable the modules. Is this ok? I am now seeing the following in my Status Report:

Database updates    Out of date
Some modules have database schema updates to install. You should run the database update script immediately.

Is it safe for me to run the database update script now? Or should I first do a core update (am currently running 7.18 and would be upgrading to 7.19)?


texts: How do I get the category links as I had them in Drupal 6, before migrating the site to Drupal 7?

texts:
I am migrating my Drupal 6 site to Drupal 7. I have vocabulary/category links like http://www.megaleecher.net/category/12.

How do I replicate this with Drupal 7? I exported the below view to Drupal 7, but it does not work.

$view = new view;
$view->name = 'vocabulary';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = '';
$view->core = 0;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'time';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'node';
/* Sort criterion: Node: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Argument: Taxonomy: Vocabulary ID */
$handler->display->display_options['arguments']['vid']['id'] = 'vid';
$handler->display->display_options['arguments']['vid']['table'] = 'vocabulary';
$handler->display->display_options['arguments']['vid']['field'] = 'vid';
$handler->display->display_options['arguments']['vid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['vid']['default_argument_type'] = 'fixed';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['query'] = FALSE;
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['path'] = 'category/%';


texts: Display fallback language, retain selected language

texts:
I've got a multilingual site where English is set as the default and fallback language. Most of the content is translated, but some of it is not. When I access some untranslated content, the fallback English is displayed, however, the site's selected language is also switched to English (so I also get English menus, etc.), so if I would then go to some page which is translated, I would still see English.

Is there a way to tell Drupal "display fallback, but display the menus and other stuff in the non-english language and remember the selected language"?

For the record, each language is in its own directory (not a domain) and language selection is done in this order:

List item
Selected Language
Session
URL
Account admin pages
User
Browser


texts:
Im using the migrate module to import data from a json feed.
Mostly work fine however, i require that each time the feed is imported , updated records in the source are updated in the destination if they exist.

Im struggling to find much information on this or more over explicitly how to implement this kind of functionality.

I have list my code to date and would really appreciate any input someone has on this.
An example might be the same feed being imported but the aboutOurClient field updated in the source

cheers

Steve

class JSONMigration extends Migration {
  /**
   * A constructor
   */
  public function __construct() {

    parent::__construct(MigrateGroup::getInstance('json_migration'));

    $http_options = array();

    // define source definitions.... wont work with out this so hey ho
    $this->map = new MigrateSQLMap(
      $this->machineName,
      array(
        'jobref' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
        ),
      ),
      MigrateDestinationNode::getKeySchema()
    );

    $fields = array(
      'jobref'                   => 'Job reference',
      'jobTitle'                 => 'Job title',
      'aboutOurClient'           => 'About the job',

    );

    $json_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'json_migration') . '/';
    $items_url = $json_folder . 'PEsamplejson.json';

    $this->source = new MigrateSourceList(new ExampleListJSON($items_url),
      new ExampleItemJSON($items_url, array()), $fields);

    $options = array();

    $options = array('track_changes' => 1);
    $this->destination = new MigrateDestinationNode('jsontest', $options);
    //$this->systemOfRecord = Migration::DESTINATION;

    $this->addFieldMapping('field_jobref', 'jobref');
    $this->addFieldMapping('title'       , 'jobTitle');
    $this->addFieldMapping('body'        , 'aboutOurClient');

  }

  public function prepareRow($row) {
     // i can remap/manipulate here if needs be ie date
  }

}


texts: Views - currently logged in user problem

texts:
There's a taxonomy list labeled games-list that's used in both the content type named game and user field subscribed. Each game has exactly one of the terms from games-list selected, but a user can select an unlimited amount of items within subscribed.

To be clear, both the user field subscribed and the content type field game are a term reference field that's linked to games-list.

My goal is to create a view that shows a list of content from game that is unique to each user, and that only shows the values of game that has been selected by the user from subscribed.

Whenever I try to filter by "currently logged in user," it only shows content that was authored by that user. Specifically, how do I configure the view to show only content that the user wants, regardless of who authored that content?


texts: How do I make my site "notice" things to index?

texts:
The built-in search feature in my Drupal site is not working. After looking online, the only solutions I've seen are to "0% of the site has been indexed" but with "x items left to index" (x>0).

My question is how do I make my site "notice" things to index?

Here's a picture of the error I get:

Update: I'm working with Drupal 7.


texts: How would I store a reference in a custom FieldType in Drupal 8?

texts:
I am developing a module for Drupal 8 and want to make a field on one entity that references another along with some additional data. e.g. Library A has a copy of Book B (of Edition 2). There will be multiple values stored in the field for each source entity. In the above example Libraries will have multiple books.

I know how to implement a new FieldType and the widget and formatter for it, but I am wondering whether this is the best way for a reference. Would it be better to create a new entity to hold the relationship with the two endpoints and additional data (like I would create an xref table in MySQL)

If I do go with a FieldType, when it comes to implementing the storage of the new field, would I just store the id of the referenced entity and then have to wrap the access in a method to change id <-> entity?

Thanks in advance for your help!
Jamie


texts: Is there an hook_node_access() equivalent for users?

texts:
Is there any way in Drupal to control access to users like it's done in hook_node_access() for nodes?
I'm looking for something like hook_user_access() or hook_entity_access().

I have an entity reference field (user reference). I want that users can only select users from their organic group, in the entity reference field.

I wanted to do it by implementing some hook like hook_entity_access(), but this hook doesn't exist.


texts: A question about Drupal Books and assigning classes to the body based on last viewed book

texts:
I have client site with a few different books in it. There are also some basic pages and other nodes that are not within the books. When you are in the first book the sidebar is blue, when you are in the second book the sidebar is green and the the third has an orange sidebar. This is controlled by a class that is applied to the body from a field in the book module.

Currently, when you access a global page (meaning a page or view outside a book) the sidebar color is a default color. But the client wants these global pages' sidebar color to stay the same as the last viewed book and not switch to a different color until a new book is viewed.

I am not even sure how to begin to go about doing this and am looking for ideas.

Thanks


texts:
I am trying to Create Services to Create Node Type Discussion in a Group using Services Module, but getting the error :

  500 Internal Server Error : An error occurred(0): Unknown data property field_group_privacy

In the Header I have given:

  Content-type:application/json

  x-csrf-token:token value

  session-name:session name value

In the Body I have given :

{
"og_group_ref": {"und": [{"target_id": "3897"}]},

"title": "Title of discussion",

"field_description": {"und": [{"value": "test description"}]},

"type": "discussion"

}

Can anyone please tell me why I am getting this error ?


texts:
I've created a view "myview" for a custom content-type.

Now I want: Any node of that content-type to be automatically redirected to that view page.

For example, if a user types: http://my-drupal-site/node/4 and that node is of my desired content-type, it needs to be redirected to http://my-drupal-site/myview/4

What I can do:

What I can do now is writing in my theme's template_preprocess_node() function following lines:

function myCustomTheme_preprocess_node(&$variables) {
    $arg1 = (int) arg(1);
    $isArg1Int = (is_int($arg1) && $arg1) ? (true) : (false);

    if (isset($variables['node']->type) && $isArg1Int) {
        if ($variables['node']->type == "MY-DESIRED-CONTENT-TYPE") {
            // REDIRECT!
            drupal_goto('myview/' . $variables['node']->nid);
        }
    }
}

That's pure hard-code, and I don't like it. Is there some elegant solution, may be using URL aliases or something like that?


texts:
The above screen shot is from Add media button in the CKeditor of drupal article content, and after selecting an image from the library. What I need to see in this window is a list of drupal's image styles in the Current format is. I'v tried to use insert module but it only works with image or file fields.

I need any tool or module that allows me to choose image from the library and insert it styled with drupal's image styles in the CKeditor!


texts:
When I am trying to access Drupal and the database is down, it will return a 500 error. However, when I try to access Drupal when Redis is down, it says:

  Additional uncaught exception thrown while handling exception.

  Original
  Predis\Connection\ConnectionException: Connection refused [tcp://drupal-redis-2:6379] in Predis\Connection\AbstractConnection->onConnectionError() (line 146 of /var/www/corp/sites/all/libraries/predis/src/Connection/AbstractConnection.php).

  Additional
  Predis\Connection\ConnectionException: Connection refused [tcp://drupal-redis-2:6379] in Predis\Connection\AbstractConnection->onConnectionError() (line 146 of /var/www/corp/sites/all/libraries/predis/src/Connection/AbstractConnection.php).

The HTTP code returned, however, is 200. This makes it difficult to detect if a server is down for load balancing purposes.

This question is similar to Site is down due to MySQL error but it returns 200/OK but it remains unanswered and is a little different.


texts:
I'm having a problem redirecting a user on login. I have a user field field_redirect_field, that is a select list (text).

I want to have a list of links of my site and the user can select in a list where he redirects after logging in. (I create the list manually)

this is an example of my values list:

  user/me/edit|me

The key is user/me/edit and the label is me. Now the problem is in my rule I have a redirect to the field [account:field_redirect_field]. But he redirects to the label and not to the key.

This is what I've tried:

I've tried to change the display of the redirect field by going to Manage Display and set the redirect field to show the Key instead of the label. But the strange thing is that he still shows the value when I want to edit a user.

How can I fix this?


texts: Hook_menu() and its page callback: how to redirect users on a condition?

texts:
I'm trying to redirect users from an existing path in Drupal 7 to another existing path. I want to implement the following rule:

comment/reply/123 should redirect to node/123#comment-form

But

comment/reply/123/456 should NOT redirect anywhere and just go where it goes.

I've tried to implement this behavior with hook_menu(), but here's the problem. When I register an item with the path 'comment/reply/%' that corresponds to comment/reply/123, it automatically includes paths like comment/reply/123/456. I know that's intended and changed my code to include this case, but can't figure out how to redirect users only when they hit comment/reply/123. Here's my code:

function mymodule_menu()
{
    $items = array();
    $items['comment/reply/%/%'] = array(
        'title' => 'bla',
        'page callback' => '_mymodule_redirect',
        'page arguments' => array(2, 3),
        'access callback' => TRUE,
        'type' => MENU_CALLBACK,
    );
    return $items;
}

function _mymodule_redirect($node_id, $comment_id)
{
    if(isset($comment_id))
    {
        return; //I want to just go to comment/reply/123/456 here, but it gives me a blank page
    }
    else
    {
        drupal_goto('node/' . $node_id . '#comment-form');
    }
}

So how do I go where I want to go?

Update: This is my final solution: I now use hook_menu_alter() to rewrite an already defined link and comment_reply() to serve standard comment form.

function mymodule_menu_alter(&$items)
{
  $items['comment/reply/%node']['page callback'] = '_mymodule_redirect';
}

function _mymodule_redirect($node, $pid = NULL)
{
    if(isset($pid))
    {
         return comment_reply($node, $pid);
    }
    else
    {
        drupal_goto(drupal_get_path_alias('node/' . $node->nid), array('fragment' => 'comment-form'), 301);
    }
}


texts: Dynamically change views entity reference filter based on current form value

texts:
Is it possible to change the result of the view depending on the value being selected on the form, node creation form without saving it first?

Last time, my problem was filtering the views depending on the field value of current node and I found the answer using

Filter View by Entity Reference Value From Current Node -

$node=menu_get_object(); return $node->field_venue_for_catering['und'][0]['target_id'];

But when I tried this on an entity reference view, it doesn't show any result unless I save the form.

The case from the link given above is almost the same for this post, the difference is filtering the view dynamically without saving the form first.

Is there anyone that will be able to help?

Thank you very much!!!


texts: How to display a confirm box before submitting a form?

texts:
On the node/%/edit form, when the user clicks the Submit button, I want to show a simple pop-up box with the text "Are you sure you want to save your changes?". When the user clicks Cancel (or No) then nothing happens. If the user clicks Ok (or Yes) then the form gets submitted.

I already tried out the A's in the following related Q's:

How to display confirm box before submitting an AJAX form in Drupal 7? but they already seem to assume the form has been AJAXified. I'm starting from scratch.
How to add a confirm dialog to node add and edit forms? is too complex since it adds extra validation options based on the user's input.
Use a custom JS modal to confirm changes made on node add/edit form before submit seems to be close but like the comments say: it doesn't actually work.

I also read some other A's that used the Rules module but that is totally overkill.


texts: Hide fields in Paragraphs conditionally using Form API #states

texts:
Because the Conditional Fields module doesn't work with paragraphs for Drupal 8, I've followed the instructions in Conditional Fields in Paragraphs Using the Javascript States API for Drupal 8 to hide some paragraphs fields, depending on the value asigned to another field.

But it only works when the dependee field value changes, when the node is edited or when a new paragraph is created, until I change the value in the dependee field manually, the dependent value is always visible.

Does anyone know how can I have those fields hidden when a value is already selected in the dependee field?


texts: Display three days in views (Calender style)

texts:
How can i display the days in my views calender (Week view) like this way:
just three days

                      Today    |   tomorrow    |   after tomorrow

in this question the solution for hours not for days, please put me in the right direction.


texts: Rebuild form AFTER ajax callback has run

texts:
I have a form with a button that when pressed re-builds a different part of the form via an ajax request.

Upon clicking the button the form is rebuilt, then my ajax callback is called which saves the values from the form, and then returns part of the form.

The problem is the form is rebuilt BEFORE my callback which saves the values, and therefor alters how the form is built.

If I click the ajax button a second time then it works correctly as has the values from the previous ajax request when the form is build.

How can I get my callback function to run before the form is rebuilt?

function emtr_shift_plan_form($form, &$form_state) {

    ddl('build'); // log that this function is being called

    $form['save'] = array(
        '#type' => 'button',
        '#submit' => array('emtr_shift_plan_form_ajax_submit'),
        '#value' => 'Save',
        '#ajax' => array(
            'callback' => 'emtr_shift_plan_form_ajax_submit',
            'wrapper' => 'postions',
        ),
        '#id' => 'ajax-save-form-values',
    );

    $form['postions'] = array(
        '#type' => ' container',
        '#prefix' => '
',
        '#suffix' => '
',
    );

    // code here to populate the positions container

}

function emtr_shift_plan_form_ajax_submit($form, &$form_state) {

    ddl('ajax submit'); // log the ajax callback is being called

    $form_state['rebuild'] = TRUE; // As the form has already been rebuilt at this point what effect can this have?!?

    emtr_shift_plan_form_save($form, $form_state); // save the values

    // This is the point at which I want the form to be rebuilt

    return $form['positions'];

}

EDIT:

As a workaround I found it is possible to manually rebuild the form a second time in the ajax callback with $form = drupal_rebuild_form('emtr_shift_plan_form', $form_state);, but is seems inefficient building the form twice. Can I just swap the order of these events over as opposed to having the build the form twice per ajax request?


texts:
I am looking for a way to hide/show some fields depending on what users select on another field. Users can select between four wheeler or two wheeler. If users select four wheeler from a drop-down, they see different set of fields than the ones show when two wheeler is selected. As there are many common fields I am looking to use the same content type for both cases.

What I have tried so far is using hook_form_alter() or  hook_form_FORM_ID_alter() in the .theme file. Neither of them seems to work for me.

This is the code I tried. (Please do note I am using themename instead of the machine name of the theme; also the field names has been changed.)

use Drupal\Core\Form\FormStateInterface; // at top of themename.theme

function themename_form_alter(&$form, FormStateInterface &$form_state, $form_id) {
  $form['field_album_type_name']['#states'] = [
    'visible' => [
      'select[name="field_album_type"]' => ['value' => 'custom']
    ]
  ];
}


texts: Pass a webform value to a node via Rules?

texts: I have a rule that is successfully creating a node of a content type when a webform is submitted. How do I pass a value from the webform into the created node via rules? (This is a Drupal 7 site.)


texts: userpoints module, what's the difference between `userpoints` and `userpoints_total`?

texts:
I'm writing a SQL script to modify userpoint totals. Best I can tell the module has three tables: userpoints, userpoints_total and userpoints_txn. userpoints_txn is straightforward enough, it's a record of the individual transactions.

Both userpoints and userpoints_total seem to be aggregate of points, however, I don't understand the difference; userpoints_total seems redundant.

userpoints_total schema is:

uid int(11) PK
points int(11)
max_points int(11)
last_update int(11)

while userpoints has two additional columns

pid int(11) AI PK
uid int(11)
points int(11)
max_points int(11)
last_update int(11)
tid int(11)

tid is 0 for all rows and pid is auto-increment primary key. does anyone know why the module maintains both tables? both have the same number of rows and consistent values.


texts: Cannot change an existing field's type. in field_update_field() line 240 of field.crud.inc

texts:
My instance of drupal is throwing an error. The file that is throwing the error is modules/field/field.crud.inc

The error is

  FieldException: Cannot change an existing field's type. in field_update_field() (line 240 of modules/field/field.crud.inc).

A local var dump displays the following results.

Variable $field

array (
  'active' => 1,
  'cardinality' => 1,
  'deleted' => 0,
  'entity_types' =>
  array (
  ),
  'field_name' => 'field_address',
  'foreign keys' =>
  array (
    'format' =>
    array (
      'columns' =>
      array (
        'format' => 'format',
      ),
      'table' => 'filter_format',
    ),
  ),
  'indexes' =>
  array (
    'format' =>
    array (
      0 => 'format',
    ),
  ),
  'locked' => 0,
  'module' => 'text',
  'settings' =>
  array (
    'max_length' => 255,
  ),
  'translatable' => 0,
  'type' => 'text',
)

Variable $prior_field

array (
  'translatable' => '0',
  'entity_types' =>
  array (
  ),
  'settings' =>
  array (
  ),
  'storage' =>
  array (
    'type' => 'field_sql_storage',
    'settings' =>
    array (
    ),
    'module' => 'field_sql_storage',
    'active' => '1',
    'details' =>
    array (
      'sql' =>
      array (
        'FIELD_LOAD_CURRENT' =>
        array (
          'field_data_field_address' =>
          array (
            'country' => 'field_address_country',
            'administrative_area' => 'field_address_administrative_area',
            'sub_administrative_area' => 'field_address_sub_administrative_area',
            'locality' => 'field_address_locality',
            'dependent_locality' => 'field_address_dependent_locality',
            'postal_code' => 'field_address_postal_code',
            'thoroughfare' => 'field_address_thoroughfare',
            'premise' => 'field_address_premise',
            'sub_premise' => 'field_address_sub_premise',
            'organisation_name' => 'field_address_organisation_name',
            'name_line' => 'field_address_name_line',
            'first_name' => 'field_address_first_name',
            'last_name' => 'field_address_last_name',
            'data' => 'field_address_data',
          ),
        ),
        'FIELD_LOAD_REVISION' =>
        array (
          'field_revision_field_address' =>
          array (
            'country' => 'field_address_country',
            'administrative_area' => 'field_address_administrative_area',
            'sub_administrative_area' => 'field_address_sub_administrative_area',
            'locality' => 'field_address_locality',
            'dependent_locality' => 'field_address_dependent_locality',
            'postal_code' => 'field_address_postal_code',
            'thoroughfare' => 'field_address_thoroughfare',
            'premise' => 'field_address_premise',
            'sub_premise' => 'field_address_sub_premise',
            'organisation_name' => 'field_address_organisation_name',
            'name_line' => 'field_address_name_line',
            'first_name' => 'field_address_first_name',
            'last_name' => 'field_address_last_name',
            'data' => 'field_address_data',
          ),
        ),
      ),
    ),
  ),
  'foreign keys' =>
  array (
  ),
  'indexes' =>
  array (
  ),
  'id' => '132',
  'field_name' => 'field_address',
  'type' => 'text',
  'module' => 'text',
  'active' => '1',
  'locked' => '0',
  'cardinality' => '1',
  'deleted' => '0',
  'columns' =>
  array (
    'value' =>
    array (
      'type' => 'varchar',
      'length' => NULL,
      'not null' => false,
    ),
    'format' =>
    array (
      'type' => 'varchar',
      'length' => 255,
      'not null' => false,
    ),
  ),
)


texts: drupal 7 Views: output a field with views php

texts:
Drupal 7.22
Views: 7.x-3.7

i have the field "content:path" and i want to output the containing data with php. I use a global php field.

it shows me this:

Available variables

$row->path: Inhalt: Pfad

but the output with print $row->path gives out a number only and not the content path. Then i tried print_r($data) to look for the correct output information. but there i dont found anything about the field: content:path

any solution to get the data of this field to php?

regards


texts:
How can I theme filters for a view in drupal 8?
I would like to place the filters to the sidebar menu, and rather than having standard either dropdown or autocomplete field, I would like to have something like a rendered block, so that a user could see all options at a glance.


texts: How can I add multiple field collections based on a reference on a new node

texts:
I am trying to figure out how can I add multiple field collections to a node when a user starts filling out a node.

Here is how my nodes are basically set up:

Color Card Content Type:
 - id
 - name
 - colors_term_reference(multi select)

Style Content Type:
 - id
 - color_card_node_reference (select)
 - color_images_collection (unlimited field collection)
   - color_term (single select)
   - image

When a user starts filling out the node form, I want the field collections to get created and all the colors that were chosen in the color card get  preselected.

So ideally if color has the following colors: red, blue, and green, when a user starts filling out my style node and chooses that color card the field collection would have red, blue, and green preselected and they would only need to upload the images.

Color Card:
- id: 1
- name: Cool Colors
- colors_term_reference:
  10 (red)
  17 (blue)
  38 (green)

Style:
- id: 1
- color_card_node_reference: 1
- color_image_collection:
  0:
    color_term: 10,
    image:
  1:
    color_term: 17,
    image:
  2:
    color_term: 38:
    image:


texts: Is there a way to bring content files into views with white space removed?

texts:
I am trying to have the title in a view, once as the first letter, once as full title, and then have Drupal group these fields, as follows.

A
Alabama
Alaska
Arizona

C
California
Connecticut

However, when someone enters content as " Alabama" with a space as first character, I get this.

Alabama
A
Alaska
Arizona

C
California
Connecticut

I have tried removing the white space in the field settings, I tried using trim($output) on the view template.
Do you have any other suggestion?


texts:
Im trying to make a selection rule for variants in Page manger and it includes some data comparison so it has to be in php. My field data is inside the context, so the $contexts variable can be used, but I cant get the proper way to use it. In my case it is a field value of the node, that is specified by the argument in URL "node/%nid".

Can some body please give an example code to extract the field value from context in php?


texts:
I have Views page with list of enities. The URL is /admin/group/12/members

There is a route in mymodule.routing.yml:

  mymodule_members_list:
  path: '/admin/group/{id}/members'
  requirements:
    _custom_access: '\Drupal\mymodule\Controller\GroupController::access'

The Group entity has field contains group administrator email (field_admin_email)

What I need is to allow administrator to only access a view with group/{id} associated with his email.
(I have only problem with views access - it seems like views override my custom access method)


texts: Call to undefined function field_attach_load() on a newly migrated site

texts:
I am moving a site over to a different server to test.
I am getting the following error:

Call to undefined function field_attach_load() in my-path-to-root/my-site/includes/entity.inc on line 320

If I try accessing http://www.example.com/randomstuff, I get this error:

Fatal error: Call to undefined function user_access() in /home/borsodas3/digipowers.devserver2012.com/modules/overlay/overlay.module on line 130
Fatal error: Call to undefined function node_access_needs_rebuild() in /home/borsodas3/digipowers.devserver2012.com/sites/all/modules/taxonomy_access/taxonomy>_access.module on line 598

phpinfo() returns following information for the two sites:

Source site
Destination site

The Drupal status report from the site I am migrating FROM looks like this:

Info
Drupal  7.8
OK Access to update.php Protected
Error CTools CSS Cache  Unable to create
The CTools CSS cache directory, ctools/css could not be created due to a misconfigured files directory. Please ensure that the files directory is correctly configured and that the webserver has permission to create directories.
OK  Configuration file  Protected
OK Credit card encryption   Credit card data is encrypted during checkout for maximum security.
OK Cron maintenance tasks   Last run 26 min ago
You can run cron manually.
To run cron from outside the site, go to mysite.com
OK Database system  MySQL, MariaDB, or equivalent
OK Database system version  5.1.57-log
OK Database updates Up to date
OK Date API System date settings
The timezone has been set to America/New_York. The first day of the week has been set to Monday. The medium date format has been set to to F j, Y - g:ia.
Error Drupal core update status Not secure! (version 7.12 available)
There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates.
OK File system  Writable (public download method)
OK Fitvids library  Installed
Fitvids Javascript Library. Download it from here, copy it to the module directory, and rename it to jquery.fitvids.js.
OK GD library PNG support   bundled (2.0.34 compatible)
OK GD library rotate and desaturate effects bundled (2.0.34 compatible)
OK Images   Product image support has been automatically configured by Ubercart.
Error Module and theme update status    Not secure!
There are security updates available for one or more of your modules or themes. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates.
OK Node Access Permissions  1832 permissions in use
If the site is experiencing problems with permissions to content, you may have to rebuild the permissions cache. Rebuilding will remove all privileges to content and replace them with permissions based on the current modules and settings. Rebuilding may take some time if there is a lot of content or complex permission settings. After rebuilding has completed, content will automatically use the new permissions. Rebuild permissions
OK PHP  5.3.2 (more information)
OK PHP extensions   Enabled
OK PHP memory limit 300M
OK PHP register globals Disabled
Warning Unicode library Standard PHP
Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.
OK Update notifications Enabled
Info  Upload progress   Not enabled
Your server is capable of displaying file upload progress through APC, but it is not enabled. Add apc.rfc1867 = 1 to your php.ini configuration. Alternatively, it is recommended to use PECL uploadprogress, which supports more than one simultaneous upload.
OK Web server   Apache/2.2.3 (CentOS)
OK cURL Enabled


texts: Can not find the price of products in ubercart tables

texts:
I need to export products from Ubercart, the problem I am facing is the price of products is shown 0.000 in uc_products in all related fields (list_price, cost, sell_price) for almost every product but on admin side and front end every product has price more than 0.000.

my question is Where else the price could be store in ubercart tables other than uc_products?

Any where in cache tables, attribute wise or somewhere else?


texts: Output term field as custom link to another view with context filter - using term alias

texts:
I have a site with two content types:

Blog posts
Forum topics

There is one vocabulary:

Tags

Both blog posts and forum topics are tagged with this vocabulary.

I have a view (view #1) listing the tags most commonly used on forum posts. I want each row/term field to link not to the normal taxonomy term page (which will list not only forum topics but all content, including blog posts) but to a separate page view (view #2) that takes terms as a contextual filter and shows only forum posts with that term.

This means I need to rewrite the field result in view #2 to be a custom link. I do not want to use the term ID token in this custom link; instead, I want to use the term alias, and then somehow catch it in view #2's contextual filter.

View #2's URL is /forum. So, for each term in the "Tags" vocabulary, there should be two usable URLs:

/tags/[tag-alias from pathauto>]
/forum/tags/[tag-alias from pathauto]

The problem is that I can't trust view #2's contextual filter to convert the [tag-alias from pathauto] URL argument to a term name because pathauto drops punctuation and other characters from term names.

How can I achieve this?

Thank you in advance!


texts:
I am using views to create a table in which I display blogs title and body. Blog is a content type in which body field can be any of plain text, HTML and full HTML. I want to display only two lines of the body for which I use trim option under Rewrite results tag, and set maximum length to 300 which serves the purpose for paragraphs. But if there is a line break then this doesn't work and the text appears in three lines. Please refer to snapshot below :

The output in row number 2 is desired one. How do I go about it?


texts: How to change upload destination from public to private when there are uploaded files in database?

texts:
There are a few fields that uses public upload destination. I changed it globally right now, as far as I know it uses private upload destination from now.
But how can I change previously uploaded files' upload destination (programmatically)?


texts:
I created a content type using views called Bars & Restaurants

I want that content type to show under my Bars & Restaurants menu link at the top of my page.

I have changed the path to http://localhost/drupal/barsandrestaurants

and the menu to: menu tab - navigation and it still only shows up on my home page.

Is there a way to display the content type only on my bars and restaurants page?

I want authenticated users to be able to go into the page and add bars and restaurants themselves.

I am very new to drupal so any help will be great!

I want the content that Im adding to be under the Bars & Restaurants page there


texts: How to filter view based on a parent node

texts:
On my website, i have some products and some master products.

Each products depend on a master product, which can have multiple products under itself. There are 2 different content type.

In the product content type, master product is an Entity Reference.

I'm trying to filter my view to get all similar products : basically, i need a view to get all products that have the same tint has the current product.

The tricky part is that the tint is a field of the master product.

Does anyone has any part of an answer?

Thanks!


texts: How do I get an OG Group Menu block to appear in View?

texts:
Running Drupal 7 with OG 7.x-2.3 and OG Menu 7.x-3.0-rc4.  I have added a view to a Group Menu that lists all content in the group.  All I want is for the group menu block to display when the view is executed.

I have added code in hook_views_pre_view to maintain the group context when view is executed.

I also attempt to utilize OG URL Group Context Detection by creating this URL path for the view:

group/%/content

I also added code in the view header/footer to detect if there is a group context when view executes.  There is.

Despite all this, I can not get the Group menu block to display when the view is executed.  Does anyone know of a way to accomplish this?


texts:
When I delete an image I previously uploaded into an Image field, the file stays on my server. It takes up space and remains publicly viewable.

Is there an easy way to get Drupal to clean up after itself by deleting uploaded files that are no longer in use?


texts:
I have a site with custom home pages depending on role. The homepages are assigned with hook_menu (hook_menu associates a URL with a function that returns a $html string.)

For one particular role, I need to generate a homepage that incorporates a view. I am looking at a list of views hooks, and not sure were to start.

In summary, how do I display a view that is generated from one of my hook_menu functions?

Edit:
I am currently looking into this code example from  http://lucor.github.com/2011/10/drupal7-how-display-block-programmatically/
The view is in now in a block.
I have not yet figured out what I either one of the parameters are suposed to be set to.

$block = block_load($module, $delta);
print render(_block_gAet_renderable_array( _block_render_blocks( array($block) )));


texts: Is there any example for real project where field of deciamal type been used?

texts:
Drupal has several types of numeric fields:

integer
float
decimal

I know, that decimal field is used to store numeric data with high accuracy. But when it may be necessary in real project? Are there any good examples?


texts: My sitemap.xml have a different domain and this is an error

texts:
I have created a site with a development domain name. Now this site is online (camperlife.it), but sitemap.xml created by XML sitemap module still contains the development domain name.

I have rebuilt sitemap many times, but without success.

Where is my problem ?