texts: How to apply a style to a specific page?

texts:
I want to apply different stype on the pages of my site.

The following code applies a hard background to all product pages :

body.path-product {
    background-image: url("/themes/contrib/bootstrap_subtheme_front_office/images/background-page.svg");
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
}

I want a different style to be applied for the product/add/produit path.

How to do this ?

Screenshot :

enter image description here

In my theme I created a file "html--product--add.html.twig" and I pasted in the contents of "html.html.twig".

{#
/**
 * @file
 * Default theme implementation to display the basic html structure of a single
 * Drupal page.
 *
 * Variables:
 * - $css: An array of CSS files for the current page.
 * - $language: (object) The language the site is being displayed in.
 *   $language->language contains its textual representation.
 *   $language->dir contains the language direction. It will either be 'ltr' or
 *   'rtl'.
 * - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document.
 * - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data.
 * - $head_title: A modified version of the page title, for use in the TITLE
 *   tag.
 * - $head_title_array: (array) An associative array containing the string parts
 *   that were used to generate the $head_title variable, already prepared to be
 *   output as TITLE tag. The key/value pairs may contain one or more of the
 *   following, depending on conditions:
 *   - title: The title of the current page, if any.
 *   - name: The name of the site.
 *   - slogan: The slogan of the site, if any, and if there is no title.
 * - $head: Markup for the HEAD section (including meta tags, keyword tags, and
 *   so on).
 * - $styles: Style tags necessary to import all CSS files for the page.
 * - $scripts: Script tags necessary to load the JavaScript files and settings
 *   for the page.
 * - $page_top: Initial markup from any modules that have altered the
 *   page. This variable should always be output first, before all other dynamic
 *   content.
 * - $page: The rendered page content.
 * - $page_bottom: Final closing markup from any modules that have altered the
 *   page. This variable should always be output last, after all other dynamic
 *   content.
 * - $classes String of classes that can be used to style contextually through
 *   CSS.
 *
 * @ingroup templates
 *
 * @see bootstrap_preprocess_html()
 * @see template_preprocess()
 * @see template_preprocess_html()
 * @see template_process()
 */
#}
{%
  set body_classes = [
    logged_in ? 'user-logged-in',
    not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class,
    node_type ? 'page-node-type-' ~ node_type|clean_class,
    db_offline ? 'db-offline',
    theme.settings.navbar_position ? 'navbar-is-' ~ theme.settings.navbar_position,
    theme.has_glyphicons ? 'has-glyphicons',
  ]
%}
<!DOCTYPE html>
<html {{ html_attributes }}>
  <head>
    <head-placeholder token="{{ placeholder_token|raw }}">
    <title>{{ head_title|safe_join(' | ') }}</title>
    <css-placeholder token="{{ placeholder_token|raw }}">
    <js-placeholder token="{{ placeholder_token|raw }}">
  </head>
  <body{{ attributes.addClass(body_classes) }}>
    <a href="#main-content" class="visually-hidden focusable skip-link">
      {{ 'Skip to main content'|t }}
    </a>
    {{ page_top }}
    {{ page }}
    {{ page_bottom }}
    <js-bottom-placeholder token="{{ placeholder_token|raw }}">
  </body>
</html>

How to put the class "body.path-product-add" in this file ?


texts: Update user fields programatically resets password

texts:
When trying to update user (custom) fields programatically in drupal 7, I get the weird problem that whenever I do, my password is reset, my user is logged out, and I have to reset password to be able to log-in again.

I have tried a few different things, none seem to work, here's my code.

global $user;
global $language;
$fullUser = user_load($user->uid);

$updateUserParams = array();

$updateUserParams['language'] = $language->language;
$updateUserParams['field_first_name'][LANGUAGE_NONE][0]['value'] = $form_state['values']['firstName'];
$updateUserParams['field_surname'][LANGUAGE_NONE][0]['value'] = $form_state['values']['lastName'];

$year = $form_state['values']['birthdate']['year'];
$month = $form_state['values']['birthdate']['month'];
$day = $form_state['values']['birthdate']['day'];

$birthdate = date( "Y-m-d", strtotime($year.'-'.$month.'-'.$day));

$updateUserParams['field_birthdate'][LANGUAGE_NONE][0]['value'] = $birthdate;
$updateUserParams['gender'][LANGUAGE_NONE][0]['value'] = $form_state['values']['gender'];
$updateUserParams['field_address']['en'][0]['thoroughfare'] = $form_state['values']['street'];
$updateUserParams['field_address']['en'][0]['postal_code'] = $form_state['values']['postalCode'];
$updateUserParams['field_address']['en'][0]['locality'] = $form_state['values']['city'];
$updateUserParams['field_phone'][LANGUAGE_NONE][0]['value'] = $form_state['values']['phone'];

user_save($user, $updateUserParams);

What am I doing wrong?


texts: Lets say I have 2 domains, A (Site A) and B (Site B). I achieved this with domain access module. Then with features and strongarm I would like to export site_name variable from both domains. How can I do it?


texts: How to override a 'group' of pages using Views

texts:
I have a hierarchical taxonomy-based website structure, and I want to use Views to override the taxonomy term pages across each level. For example, if the structure was such (using taxonomy terms):

- Food (Vocabulary name)
    - Fruit
        - Red
            - Apple
        - Yellow
            - Banana
    - Meat
        - Lamb
        - Buffalo

I want to use a single view with contextual filters for both Fruit and Meat, and a completely different view with contextual filters for Red and Yellow, and for Lamb and Buffalo, because I want them to display data in different ways.

I have managed to create a (page) view that applies to each taxonomy term page by setting the path as taxonomy/term/%, but the problem is, that view also applies to the inner pages, which I don't want.

So how can I override the taxonomy term pages with separate views for each hierarchy level? Some sort of path filtering, or block views, etc?


texts: How do I get the name and URL alias of a vocabulary using only  the vid?

texts: I need the URL alias of the vocabulary, not the term and not the machine name; I need the name that appears to the user.


texts: Can a view "a" appear only in the page of view "b"?

texts:
I have a view I want it appears only in the page of another view.

Is it possible without writing code?


texts: Drupal 7, hook permission for view published content only for certain content type/blog

texts:
I disabled the view published permission for anonymous user. but I wanted to allow anonymous user to view the blog section with views on it, and I cant seem to hook permission on that particular blog.

is there any clue for this?

thank you


texts: How to add payment method field to the footer of an order summary view?

texts:
I can add payment method field to fields in my view, but it is not available to add in footer.

Why is it? How could I add it this field in the footer view?

Note:  My view is an order summary view, showing all line items, I would like to display below of the lite items, what was the payment method used. I think the footer would be a nice place to put this information, but I don't see the token for it. I can see the token to add in fields but not in footer.


texts: How to display 01, 02... instead of Jan, Feb... on Select List with Date

texts:
I use Drupal7.
I have a profile2's field, named "Birthday".
I set the FIELD TYPE as Date. And, I set Custom input format as "Y-m-d" under "More settings and values" on field edit page. This is because, simply, I want the select list displayed like "2015 07 20(year month day)".
But, on user registration page, it is displayed as "2015 Jul 20". As I wrote, I want to display 01, 02... instead of Jan, Feb... on Select List.
Did I do anything wrong? I apologize if this is an obvious question to you. But, I've been searching the solution for hours and don't find yet. Any tips will be appreciated.Thank you in advance.


texts: Ajax reloading a view with ajax mini pager

texts:
I have this view, a 'block' display that has ajax enabled and have a mini pager that loads next page content through ajax.

As a requirement I have to reload the current view content through ajax along with some custom sort/filter.

After going through some forums, I did something like below.

in .module page callback :

$view = views_get_view('vdlibrary');
$view->set_display('block');
$view->set_use_ajax(TRUE);

$settings = array(
    'views' => array(
        'ajax_path' => url('views/ajax'),
        'ajaxViews' => array(
            array(
                'view_name' => $view->name,
                'view_display_id' => $view->current_display,
                'view_args' => check_plain(implode('/', $view->args)),
                'view_path' => check_plain($_GET['q']),
                'view_base_path' => $view->get_path(),
                'view_dom_id' => 1,
                //'pager_element' => $view->pager['element'],
            ),
        ),
    ),
);
drupal_add_js($settings, 'setting');
views_add_js('ajax_view');

in JS I am calling below ajax function on a click event to load the new views content based on the condition.

for (var key in Drupal.settings.views.ajaxViews[0]) {
  data[key] = Drupal.settings.views.ajaxViews[0][key];
}
// I add additional filters/sort params to var data.
$.ajax({
  url: Drupal.settings.views.ajax_path,
  type: 'GET',
  data: data,
  dataType: 'json',
  success: function(response) {

    $(".vdr_container").html(response[1].data);

  },
  error: function() {
    // handle error response.
  },
});

Not surprisingly, after it loads the content, the ajax pagination feature not working instead it reloads the page along with params. How do I keep the old context or make the new loaded views to rebind pager click event to work with ajax pager.

NOTE: my descriptions might not be good enough, let me know where I could explain in better way.

Thanks


texts:
Hi I have a page in which I have added 2 blocks in both blocks I have paging,but when ever i click any page number of either a block both the page change simultaneously in Drupal7

$output .= theme('pager', array('tags' => array()));
This is generating pager.

Pls help


texts: Update existing content using migrate module

texts:
I'm using migrate module in Drupal 7 to update existing content of a Drupal site. My source and destination tables are the same. I got some documentation from http://drupal.org/node/1117454. Here's my code:

<?php
class MTestMigration extends Migration {

  public function __construct() {
    parent::__construct();
    $this->systemOfRecord = Migration::DESTINATION;
    $this->team = array(
      new MigrateTeamMember('foo', 'foo@bar.com', t('Site builder')),
    );

    $this->description = t('Migrate basic slides');

    $source_fields = array(
      'nid' => t('The node ID of the slide'),
      'title' => t('The node title of the slide'),
      'uri' => t('the slide image'),
    );

    $q = db_select('node', 'n');
    $q->leftjoin('field_data_field_image', 'i', 'i.entity_id=n.nid');
    $q->leftjoin('file_managed', 'f', 'i.field_image_fid=f.fid');
    $q->fields('n', array('nid', 'vid', 'type', 'language', 'title', 'uid', 'status', 'created', 'changed', 'comment', 'promote', 'sticky', 'tnid', 'translate'))
      ->fields('f', array('uri'))
      ->condition('n.type', 'slide', '=');
    $this->source = new MigrateSourceSQL($q, $source_fields);

    $node_options = MigrateDestinationNode::options(LANGUAGE_NONE, 'filtered_html');
    $this->destination = new MigrateDestinationNode('slide', $node_options);

    $this->map = new MigrateSQLMap($this->machineName,
        array(
          'nid' => array(
            'type' => 'int',
            'unsigned' => TRUE,
            'not null' => TRUE,
            'description' => 'Unique Node ID',
            'alias' => 'n',
          )
        ),
        MigrateDestinationNode::getKeySchema()
    );

    $this->addFieldMapping('is_new')
      ->defaultValue(TRUE);

    $this->addFieldMapping('nid', 'nid');
    $this->addFieldMapping('title', 'title');
    $this->addFieldMapping('is_new')->defaultValue(TRUE);
    $this->addFieldMapping('uid', 'uid');
    $this->addFieldMapping('revision')->defaultValue(TRUE);
    $this->addFieldMapping('revision_uid', 'uid');
    $this->addFieldMapping('created', 'created');
    $this->addFieldMapping('changed', 'changed');
    $this->addFieldMapping('status', 'status');
    $this->addFieldMapping('promote', 'promote');
    $this->addFieldMapping('sticky', 'sticky');
    $this->addFieldMapping('comment', 'comment');
    $this->addFieldMapping('language')->defaultValue('und');

    $this->addFieldMapping('path')->issueGroup(t('DNM'));
    $this->addFieldMapping('pathauto_perform_alias')->defaultValue('1');

    $this->addFieldMapping(NULL, 'name');
    $this->addFieldMapping(NULL, 'vid');
    $this->addFieldMapping(NULL, 'type');
    $this->addFieldMapping(NULL, 'language');
    $this->addFieldMapping(NULL, 'tnid');
    $this->addFieldMapping(NULL, 'translate');

    $this->addFieldMapping('field_image', 'uri')
      ->arguments(FILE_EXISTS_RENAME);
  }
}

I end up with this error:

  Column not found: 1054 Unknown column 'map.destid1' in 'field list':
  SELECT n.nid AS nid, n.vid AS vid, n.type AS type, n.language AS
  language, n.title AS title, n.uid AS uid, n.status AS status,
  n.created AS created, n.changed AS changed, n.comment AS comment,
  n.promote AS promote, n.sticky AS sticky, n.tnid AS tnid, n.translate
  AS translate, f.uri AS uri, map.destid1 AS migrate_map_destid1,
  map.needs_update AS needs_update FROM {node} n LEFT OUTER JOIN
  {field_data_field_image} i ON i.entity_id=n.nid LEFT OUTER JOIN
  {file_managed} f ON i.field_image_fid=f.fid LEFT OUTER JOIN
  {migrate_map_mtest} map ON n.nid = map.sourceid1 WHERE (n.type =
  :db_condition_placeholder_0) AND (map.sourceid1 IS NULL OR
  map.needs_update = 1) ; Array ( [:db_condition_placeholder_0] => slide
  ) in MigrateSourceSQL->rewind()


texts: Twig dump not working (PHP Warning: Leaked 2 hashtable iterators )

texts:
I'm trying to create a custom markup for a views-block. What I want to do is similar to what someone is trying to do here (How to create a custom markup for a views-block?).

My view-block has 3 items and I want to create a template where I can individually place them using HTML code. At the moment it just gets rendered from {{ content }} in my block--views-block--latest-block-1.html.twig. I guess I'd need to check how the three elements are stored in the content so that I can individually place them in my HTML markup.

The Twig dump function however doesn't seem to work. I get the following error message when loading my webpage:

PHP message: PHP Warning: Leaked 2 hashtable iterators in Unknown on line 0

What's going on?


texts:
Do I need to hardcode the image path to JavaScript and CSS files?

#mydiv { background: url(http://example.org/themes/mytheme/image/bg.png); }

I cannot use {{ base_path }}/image/bg.png in .js and .css files, which works in a template file.

Is there better way than hard-coding?


texts: Is checking the value of $order->status sufficient to understand when an order has been completed?

texts:
If I want to use this hook in order to execute a code when the order is complete.
function hook_commerce_order_update($order) {
  if ($order->status == 'completed') {
    // ...
  }
}

Is this condition sufficient, or should I add the following in order to prevent the confusion with the complete status that belongs to the checkout state?
 if ($order->status != $order->original->status) {
    $status = commerce_order_status_load($order->status);
    $state = commerce_order_state_load($status['state']);
    if (($state['name'] == 'completed') && ($order->status == 'completed')) {
      // ...
    }
  }


texts: 500 Internal Server Error Services REST JSON Content

texts:
I am retrieving JSON from my Drupal Site to show content on an external Device. I am using Drupanium/REST/Services to do so.

Now the problem is weird.

When I try to access this URL, it works fine:-

  .../api/rest/views/region.json

But when I try to run this URL, it gives me a big, shiny and horrendous Internal Server Error (500)

  .../api/rest/views/content.json

I am using Fields in the region.json and Content in content.json within views. I am also attaching a screenshot for both corresponding views, as it might help.

Region View

Content View

P.S. Content.json just have to load all of the articles, whereas regions just show the region field.

Do you have any idea what might be wrong.


texts: How do i rewrite path field in views-view-fields.html.twig inside a href tag?

texts:
i would like to rewrite the value of my view's path field in views-view-fields.html.twig template. I tried the following and the link is messed up.

{{ fields.title.content }}

my guess is it needs to be written with some type of filter combination and i looked everywhere and can only find examples on how to do this in a node.html.twig file but not in views templates. would somebody kindly advise on how to write this? Many thanks!


texts: Billing address missing for recurring orders

texts:
I'm using Datatrans module as payment gateway. Module does not fully support recurring payment, so I had to add some missing functionality. I added method createPayment:
  public function createPayment(PaymentInterface $payment, $capture = TRUE) {

    // Allowing only new payments
    $this->assertPaymentState($payment, ['new']);

    $payment_method = $payment->getPaymentMethod();
    $amount = strval(floor(floatval($payment->getAmount()->getNumber())*100));

    // Calling Datatrans API and handling response
    $transaction_data = [
      'apiUrl' => $this->configuration['r_api_url'],
      'errorEmail' => $this->configuration['r_error_email'],
      'successEmail' => $this->configuration['r_success_email'],
      'transactionRefNo' => $payment->getOrderId(),
      'merchantAccountId' => $this->configuration['r_merchant_id'],
      'merchantAccountPassword' => $this->configuration['r_merchant_password'],
      'sign' => $this->configuration['r_sign'],
      'req_type' => $this->configuration['req_type'],
      'expm' => $payment_method->expm->getValue()[0]['value'],
      'expy' => $payment_method->expy->getValue()[0]['value'],
      'amount' => $amount,
      'currencyCode' => $payment->getAmount()->getCurrencyCode(),
      'aliasCC' => $payment_method->getRemoteId(),
    ];

    $transaction = DatatransHelper::makeTransaction($transaction_data);

    // Saving payment locally

    $next_state = $capture ? 'completed' : 'authorization';
    $payment->setState($next_state);
    $payment->setRemoteId($transaction["uppTransactionId"]);
    $payment->setExpiresTime(strtotime('+5 days'));
    $payment->save();

  }

And it works, but problem I have is that all recurring orders created by recurring module do not have billing addresses.
Looked at database and condition for an order to have billing address (table "commerce_order") it must have id of user profile set in fields "billing_profile__target_id" and "billing_profile__target_revision_id". If I put some billing profile ids there directly, by editing database billing profile for that order appear and everything works as expected.
What (and where) should I add to my code to set that billing address?
Inside RecurringOrderManager() , refreshOrder() and createOrder() methods I saw row like:
 $billing_profile = $payment_method ? $payment_method->getBillingProfile() : NULL;

and that getBillingProfile() may be the method I'm missing (I do have null instead of billing profile id in database), but what confuses me is that it's defined in PaymentMethodInterface and Datatrans module is not implementing it at all?!
Is it up to Datatrans module to do something in order to set billing profile? How can I do that? I'm not very familiar with this and any hint is welcome.


texts: Best practices for implementing custom caching?

texts:
For every instance of every type of entity, I generate a number of caches, named something like: [module_name]__[entity_type]__[entity_id]__[string_depending_on_where_the_cache_came_from]

Now whenever a entity is updated, I want to drop all caches starting with the relevant entity type and id.

How should I store/clear these caches?

Currently I just cache_set(), but that presents a problem when I want to clear, as I don't know the names of all the relevant caches. Is it safe to drop cache entries with a db_delete()?


texts:
How do I programmatically set up multiple default flags?

The documentation shows how to create a single flag using mymodule_flag_default_flags(). If I need two or three default flags for my custom module, how could I achieve it?


texts: Send login link in email to registered users

texts:
On my Drupal 6 website, there are around 400 users registered by site admin and none of then know that they are registered on the site. Now I want to increase the number of registered users but in a secure manner.

I want the registered users to be able to invite at most 5 people whom they think are the most eligible. This is very easy and has been done.

The problem is that to invite new users, the current users will need to login and I dont want them to know their username and password as they will be given to them later.

So the only solution that remains is that I send them a login link in their e-mail so that they can click on the link and get automatically logged in so they can invite 5 other people of their choice.


texts: Images and styling not rendered correctly on page refresh

texts:
The problem is that images and some styles are not correctly rendered when I hit Cmd+R and doing a refresh, but it is working fine on a reload.

So my question is not what the difference between a reload and a refresh is, as that would be off topic, but I want to know what Drupal specific reasons could cause this.

As I have read I think that it maybe could be some files directory permissions, but it does'nt seems to be that.

Anyone who ran into this before?


texts: How do I verify that the form input date is valid?

texts:
Some browsers (e.g. Safari) allow rubbish dates to slip through a form Date field so that  we get a fatal PHP error  (Call to a member function format() on null) when we invoke the DrupalDateTime::format() per the code below which doesn't catch any exception.

The user can type 19-00 into the time part of the date field instead of 19:00:00 and this will cause Drupal 8.0.5 to crash.

What is the correct way to test that a date in a DrupalDateTime object in the form array can be formatted properly? This doesn't work (snippet from an entity_builder for new and changed Meeting Nodes in our Meeting module):

try {
    $formatted_date_of_meeting = $date_of_meeting->format('l, j F Y');
} catch (\Exception $e) {
    $form_state->setError($form, $e->getMessage());
}
$node->setTitle($name_of_meeting.' on '.$formatted_date_of_meeting);


texts: How can i debug why files are not being created when using migrate files to media module?

texts:
I run the drush migrate-duplicate-file-detection migd8_grants_media_step1 successfully, and then run the node migration and step 1, however the media is being populated with the name only, the file is not attached nor are the files being moved over to the sites default/files/grants directory as they should
Steps to reproduce
this is my step 1 yml.
# File to Media Migration configuration for grants Media migration

id: migd8_grants_media_step1
label: Grants Media Step 1
migration_group: cncs
source:
  key: migrate
  plugin: media_entity_generator_d7
  entity_type: node
  bundle: grants
  langcode: und
  d7_file_url: 'https://www.externalwebsite/sites/default/files/'
  field_names:
  - field_files

destination:
  plugin: entity:media

process:

  bundle:
    plugin: default_value
    default_value: document

# Using the alt tag if available, else the file name.
  name:
    plugin: media_name
    source: file_name

# This process plugin will skip the whole row if a existing media is found.
  existing_media_file:
    plugin: check_media_duplicate
    source: target_id

# This process plugin will skip the whole row if a duplicate document is found.
  unique_file_id:
    plugin: check_duplicate
    source: target_id

# Map the field
field_media_document/target_id: target_id
field_media_document/target_id:
  plugin: media_file_copy
  move: FALSE
  reuse: TRUE
  path: 'public://grants/'
  source: file_path

langcode: und

uid:
  plugin: default_value
  default_value: 1


texts: How to show event title and time in calendar block?

texts:
I have create a view based on the template. The events are shown up properly as a link in the calendar block:

How to I add also the event name and time (similar to the month page)? i.e.:


texts: Fixing bad node that makes search not index, but completes cron

texts:
Upon updating to the latest version of Drupal 7, the following errors presented themselves in the site:

Warning: Creating default object from empty value in node_build_content() (line 1398 of /var/www/html/modules/node/node.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7881 of /var/www/html/includes/common.inc).

These errors don't seem to interfere with much on my site, however, they do seem to stop cron from indexing the website. I've been sitting at 0% of 456 pages with a 500 page max for a week or two now since my first noticing.

I've done a lot of digging trying to resolve this issue and the following link is the closest thing I can find in resolving this issue: http://tappetyclick.com/blog/2013/01/14/how-find-bad-node-makes-search-indexing-cause-drupal-cron-fail#.Vuw1KhIrJTY

The difference between the link above and my issue is that my cron successfully submits, even though right before the success message in the report log, it produces the EntityMalformedException: Missing bundle property listed in the bullets above. Outside of that, its relatively the same story. I've gone through the step-by-step in that link and many others like it without any resolution.

I've also additionally run this through devel_debug and a few other options to better troubleshoot but no other errors produce. Devel_debug actually doesn't list any errors at all in its log.

At this point I'm up for suggestions as I'm running low on ideas of how to remedy what seems to be a relatively multi-possible bug. Any thoughts the community may have or links to previously helpful posts would be appreciated.

Thank you in advanced!


texts: How to create a scheduler for updating a boolean value using Rules?

texts:
I am displaying a boolean value as 'New' along with published content title.

Now I need like, the 'New' tag should be displayed for a period (ex: 3 months). After this period I need that content as it is, but 'New' tag should be removed.


texts: Display Suite Block Field, missing in transcendent node reference rendered display

texts:
i'm having trouble getting this right. any help is much appreciated. thanks.

I have 3 content types:

A = product
B = additional attributes for product
C = retailer of product

content type B and content type C are created from and related to content type A via autocomplete node reference field.

I created a views block of all content type B related to content type A.

I created a display suite block field for the block and added it to the node display of content type A. render as full node.

all good so far.

Now on content type C display; I used the node reference field that is referencing my content type A node, and use render full node. so I have my content type A node as field attribute on my content type C node, but that rendered content type A node reference field does not include the rendered content type B node block field.

I need that content type B ds block field to be a permanent attribute of content type A, so it shows when I render content type A on content type C

should display suite block field work in this case ?

what should my views settings look like (generally) to make the node reference block field transcendent?

what I am missing?

Thank you


texts: Page Title outputting leading/trailing whitespace within H1

texts:
My Drupal 7 site is printing out leading and trailing whitespace and a line break within the page title <h1>. The following is an exact copy and paste of the HTML that's being delivered to the browser:

<h1 class="title" id="page-title">
                I am a Page Title               </h1>

Not too big of a deal as most browsers know to ignore whitespace... except Chrome for Windows... where it's making the last word in the page title wrap to the next line (I confirmed this by deleting the whitespace in Chrome's web inspector):

Why is it doing that? Is there a fix? I can think of a handful of ways to trim the the whitespace using Javascript (can it be done with CSS?), but I'd rather fix it at the source.


texts: How to pre-populate a text field when creating a new node?

texts:
I am using Drupal 7. I have a Content Type called Request. I have two fields "Manager Name" (type Text) and "Manager Email Address" (type Email). When the user creates a new node of type Request, I want to pre-fill these fields with "Hello World" and "nobody@yahoo.com". Here is what I have tried so far (This is all in mymodule_form_node_form_alter):

$form['field_manager_name']['und']['#default_value'] = "Hello World";
$form['field_manager_name']['und']['#suffix'] = "Enter in the name of your immediate supervisor.";
$form['field_manager_email_address']['und']['#default_value'] = "nobody@yahoo.com";
$form['field_manager_email_address']['und']['#suffix'] = "Enter in the email address of your immediate supervisor.";

The two suffixes are working. When I create a new node of type Request, the suffix text appears under the field name, as expected. But the "default_value" fields are not working. What am I doing wrong?


texts: What are the performance implications of running a frequent simplenews cron task to send emails?

texts:
In the Simplenews docs there is the following tip:

  The Elysia Cron module (http://drupal.org/project/elysia_cron) can be
  used to start the simplenews cron hook more often than others, so that
  newsletter are sent faster without decreasing site performance due to
  long-running cron hooks.

This is great because it will clear the mail spool without waiting for several cron runs to occur. However what are the performance implications of running this cron task on an ongoing basis with a short interval of say 30 minutes? Especially if a newsletter only gets sent once a month. i.e. My simplenews cron task in running every 30 minutes with nothing to do.


texts: Select all nodes that reference the current node

texts:
I'm new to Drupal and am wondering if anyone could provide direction on this.

Basically I have 2 content types - one called 'clinics' and one called 'clinic groups'. Each 'clinic' has a node-reference to a 'clinic group' node. What I'm trying to achieve is basically, if I'm on the 'clinic group' page - I'd like to pull back all the nodes 'clinics' under it, that reference it.

Is this possible in views?

Thanks everyone.


texts: How do I add classes to read-more link and add-comment link on node for bootstrap 3

texts:
Witch preprocess function let me add btn classes from bootstrap 3 to the two links at the bottom of every teaser in Drupal 7?

I tried the following.

function meetu_preprocess_node(&$variables) {
   $variables['content'] ['links']['node']['#links']['node-readmore']['attributes']['class']
 [] = 'btn btn-primary'.
   $variables['content'] ['links']['node']['#links']['comment-add']['attributes']['class'][]
  = 'btn btn-primary';
  }

The result is that my "add comment" link is gone and the "read more" link has its new classes.

What's wrong here?

Is this the right way to add bootstraps btn calsses to the two links named above?


texts:
I have views of ubercart products which are displayed in a table by standard drupal view standards.
How can i theme individual product fields ?

views-view-field.tpl is having the complete product listed inside $output variable..
I want to solve this in a template file where all fields are available individually ..


texts:
I have a route that renders a node. Unfortunately in the breadcrumb the route title is rendered rather than the node title. When I preprocess in hook_preprocess_breadcrumb() inside my module only the preceding links are available inside $variable (not the current route title).

However, if I go to do hook_preprocess_breadcrumb() in my theme, the route title is inside $variables. So I could change it there but I want the functionality to be encapsulated inside my module, not split between module and theme.

I tried to create my own custom breadcrumb builder but I don't want to build it from scratch as there is some complex functionality built by other developers. I want to get the current breadcrumbs and then just replace the last one (the current page title) with my own.

I tried hook_system_breadcrumb_alter() as well but again the current page title is not showing up in variables inside my module.

<?php

class DefaultProductListBreadcrumbService implements BreadcrumbBuilderInterface {

  /**
   * Whether this breadcrumb builder should be used to build the breadcrumb.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   *
   * @return bool
   *   TRUE if this builder should be used or FALSE to let other builders
   *   decide.
   */
  public function applies(RouteMatchInterface $route_match) {
    // TODO: Implement applies() method.
    return true;
  }

  /**
   * Builds the breadcrumb.
   *
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   *
   * @return \Drupal\Core\Breadcrumb\Breadcrumb
   *   A breadcrumb.
   */
  public function build(RouteMatchInterface $route_match) {
    // TODO: Implement build() method.

    $breadcrumb = new Breadcrumb();
    $breadcrumb->addLink(Link::createFromRoute('Home', '<front>'));

    return $breadcrumb;
  }

}

For reference, I'm using bootstrap as the base theme with multiple sub themes (it's a multisite). I can't find anywhere that's adding the page title in the theme. I'm also using easy_breadcrumb module but I checked there and the page title is also not shown there.


texts:
I'm attempting to follow this documentation to add a custom constraint to a field in a Paragraph but I'm having trouble actually accessing that field.

Currently I have my_content_type with paragraph_field. This field accepts a number of different paragraph types. I'd like to be able to add a constraint to a field on a specific paragraph type that could be added to that field.

I've tried using hook_entity_bundle_field_info_alter, hook_form_alter, and hook_field_widget_form_alter but am having trouble actually accessing the proper field.

Is there a better way to do this?


texts:
I created a module for searching values from external databases. My controller creates a form and send it to the custom twig page of my module.

The controller method that creates the form and send the data to the twig template looks like:

 public function customSearchPage($query, $results)
    {
         $searchForm = \Drupal::formBuilder()->getForm('Drupal\movies\Form\SearchForm');

        $searchForm['searchQuery']['#value'] = $query;

        return [
            '#theme' => 'insert_movie_page',
            '#form' => $searchForm,
            '#query' => $query,
            '#results' => $results,
        ];
    }

Now I created a Form using the Drupal 8 Form API. The submitForm method will send the inserted data to a compute class and gets a resultset back (array with multiple model objects). Now I need to send the resultset back to the twig template to show the results to the users. How can I achieve this behaviour?

SubmitForm method looks like:

 public function submitForm(array &$form, FormStateInterface $form_state) {

      $search = $form_state->getValue('searchQuery');

      $SearchController = new SearchController;
      $results = $SearchController->searchMovies($search);
  }


texts: How do you move a file/image reference attached to a current node to a different node?

texts:
I found this previous question, but I'm struggling to adapt it to what I want to accomplish.

How can you take a file/image that is attached to one node, and move it to another or create a new node and attach it there?


texts: Where should I place .htaccess to take effect in a particular site?

texts:
We have an Apache web server that contains several Drupal 7 installations. Where should I place a .htaccess file in order for its contents to take effect on a particular website?

I tried putting it here /opt/apache/var/www/html/drupal-7.19/sites/thewebsitename but it didn't work.


texts: Can I filter entityFieldQuery results by Workbench moderation state?

texts:
I have the Workbench module and I want to look up nodes which have a specific workbench state with EntityFieldQuery.

I can get articles assigned to a user as follows:

$articles = new EntityFieldQuery();
$articles->entityCondition('entity_type', 'node')
         ->fieldCondition('field_moderating_user', 'uid', $user_id, '=');

Now I want to add a condition that only gets articles that have the state 'assigned'.

Any ideas?


texts:
I have a form that has been working just fine.

There are two fields a Select field with a list of countries and a textfield for Towns for Autocomplete.

I decided to create a collapsible fieldset called ['returndetails'] to put these two fields in.

My problem I have seems to be with the function that returns the updated div after I select a country. If I use

return $form['returndetails']['return_officename'];

The autocomplete does not work and if I use

return $form['return_officename'];

The officename text field is removed.

Can anybody help?

Thanks
Simon


texts:
I'm trying to set up a CSV import to create nodes. On the Mapping page for the feed import, several of the fields in my target node type are not listed in the dropdown box to select as a target field. I don't know why.

Some info:

All the fields that aren't showing up are of type Time, added by the cck_time module. I've not seen any specific issues with mapping this field type, but it does seem like the common denominator here.

I set up the feed, then added extra content fields. The fields that aren't showing up were all added at this later point, although others that were added at the same time are. I've flushed cache several times.

Several of the fields share the same label (ie: "Earliest booking"), although obviously not the same machine name. (For instance, there's one "Earliest booking" field for each weekday, and the field is nested inside a group for that weekday). Other fields that share identical labels are showing up in the Mapping dropdown.

The feed isn't Attached to the content type (under Basic Settings), it uses a standalone form. It uses a Node processor and the selected Bundle is the content type.

Any ideas? Why would a content field not show up in that Mapping dropdown? Have I missed some vital step?


texts:
We are attempting to figure out how to properly add Chosen library to our custom theme. The main reason for doing this is to be able to add the Chosen JS files, but use a custom css file where we can control the output.

After reviewing Chosen Module we found that it adds a lot of bloat that we don't necessarily need and have found it difficult to override the css that is used.

Here is what we tried, but cannot get it to use the chosen.min.css and need help to see how it can be done.

mytheme.libraries.yml file

chosenjs:
    version: 1.x
    css:
       theme:
          css/chosen.min.css: { minified:true }
    js:
      js/chosen.min.js: { minified:true }

The chosen.min.js has the necessary settings to get the functionality we needed.


texts: Theming long lists of checkboxes- How can I divide lists of checkboxes into multiple columns?

texts: Some of the fields on my user edit pages contain very long (more than 10 items) lists of checkboxes.  How can I theme such lists so that they are displayed in multiple columns instead of one long list?


texts: How to disable drupal empty comments error?

texts:
I'm new to drupal.
I have created a custom module, where user can post comments for the videos.
I have used default comment module in drupal for calidation. ie(modules->comment->comment.module).
But on giving a empty comment it is showing validation in a page called (/comments....)
let us assume my page is www.drupal.com/videos
I want the validation to be shown in the same page..
Plss help

This is the custom code in comment.module

if (empty($comment->cid) && empty($comment->pid)) {
  $form['#action'] = url('comment/reply/' .$comment->nid);
}

In the url tag i've given my custom url. but it redirects to that page,
but the empty comment error is showing in some other random page every time.


texts: Can theme function be implemented in a module file?

texts:
For example, in bartik theme, it has

/**
 * Implements theme_menu_tree().
 */
function bartik_menu_tree($variables) {
  return '
' . $variables['tree'] . '
';
}

Is there a way to override it via .module file?


texts:
Unlike other elements, the base twig suggestions for menus are only "menu.html.twig" and "menu-[menu_name].html.twig".

I am aware that I can generate additional suggestions through the hook THEME_theme_suggestions_menu_alter, but the $variables array does not contain any useful data. Case in point, I want to retrieve the current region, is it possible?


texts:
I am auto generating taxonomy terms basis of a text field with rules. I need to auto assign the newly generated taxonomy term to the node basis of the text field. I have tried the Rules Autotag as well as Taxonomy Autotagger. With both the modules, it does not pick any taxonomy terms.

I am trying to assign the Taxonomy Terms with rules, however, with the "Set a Data Value" option, it does not give me the option to select a Text Field to assign the Value for the Term Reference Field.

Please advice, how to assign a Term Reference Value from a Text Field using Rules?

Thanks


texts:
I have multiple events, each event can have multiple dates. When an events first end date is passed the event no longer shows, even though future dates are still available.

Current view filter settings:

I'm not sure what Date:delta(= 0) is but when it's removed, all versions of events are shown. Even though published filter is set it shows all unpublished and drafts.

I've been debugging this for several hours and would appreciate any help.


texts: Display content having the taxonomy of the logged in user

texts:
I need help creating a view in Drupal 7 with the following logic:

My users have taxonomy reference field.
My articles also have    taxonomy reference field.

When a user is logged in I want them to see only the articles that have the same term as the logged in user.  How to set the relationships and contextual filters in this view?


texts: Create a table with courses of a certain curriculum

texts:
I'm a newbie when it comes to Drupal. I already tried to do it with content types and views but can't seem to accomplish what I need.

I need to create a table with a list of curriculum. Each curriculum name should be a link. So, when you click on a certain curriculum, it'll take you to a page with a table that lists the courses for that curriculum.

Something like the following:

Curriculum List
| Name      | Total Credit Hours |
----------------------------------
| Drupal 7  |                 15 |
| WordPress |                 15 |
| Joomla!   |                 15 |
----------------------------------

Then, when user clicks on Drupal 7:

Drupal 7 Courses
| Name                                         | Credit Hours |
---------------------------------------------------------------
| Drupal 7 Essentials                          |           3  |
| Drupal 7 Advanced Training                   |           4  |
| Drupal 7: Reporting and Visualizing Data     |           4  |
| Drupal 7: Creating and Editing Custom Themes |           4  |
---------------------------------------------------------------

If possible, I don't want to create this by writing a template file since I'm new to Drupal. If someone can at least point me in the right direction I will really appreciate it.

Thanks in advance.


texts:
I'm working on a local development environment (via Acquia Dev Desktop).  Our theme is a subtheme of the Stack theme.

In this situation, I'm making changes to my .theme file, but they don't seem to be loading at all.  If I make the same changes to the stack.theme, they load and work as expected.

I've ensured I'm using function <subtheme>_theme_suggestions_page_alter but still no luck.  There is nothing in the error.log either.


texts: how do I add check boxes in form created with the Registration module?

texts:
I am getting a radio button in my form as default, but I want a checkbox.

I am using the Registration and the Entitiy Registration modules. How can I do that?


texts:
I'm trying to create a menu in Drupal 8 that is just sibling links of the current page. So if the menu is:

Home
Parent 1

Sub-parent 1

Child 1

Sub-parent 2

Child 2
Child 3
Child 4

Parent 2

When I'm on the "Child 3" page, I want a menu block to link to look like this:

Child 2
Child 3
Child 4

I know how to do this in D7, I think, but I'm having a hard time translating that knowledge to D8. Is this even something that is doable in D8? And if it is, can someone point me in the right direction on how to do it?

Thanks!

Clarification: The child level needs to be variable, so that menu items with different depths can display their siblings. So for instance, in addition to wanting a menu for the children, I'd need a menu for the sub-parents and a menu for the parents and so forth. I also have no control over/knowledge of how deep the menu goes and if it goes that deep on all sections.


texts:
I used the following code.

libraries.yml

    my_module.admin:
  version: VERSION
  js:
    js/my-module.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/drupalSettings

my_module.module

 /**
 * Implements hook_page_attachments().
 */
function my_module_page_attachments_alter(array &$attachments) {

$attachments['#attached']['library'][] = 'js/my_module';
  // $attachments['#attached']['library'][] = array('my_module', 'admin');
}

my_module/js/my_module.js

(function($, Drupal, drupalSettings) {
    Drupal.behaviors.my_module = {
      attach: function(context, settings) {
        $(document).ready(function() {
            alert("hello");
            console.log('Loaded');
          }
        };
      })(jQuery, Drupal, drupalSettings);

I have tried many other changes, but the JavaScript file is not used.

I have ported Drupal 7 code that implements hook_boot() and includes that JavaScript file, to Drupal 8.


texts: Search Box to Search Text on Current PAge

texts:
Is it possible to add a search box to a specific page and search for ONLY the text on that page?

If so, any pointers would be helpful. Is there a module for this?

Thanks


texts: When is ["und"] necessary in pre process hooks?

texts:
I've noticed in preprocess hooks that sometimes a field's value is found at - for example:
$vars['field_caption'][0]['value']
and sometimes it's at
$vars['field_caption']['und'][0]['value']
Which makes it awkward to handle.
What situations result in the 'und' (LANGUAGE_NONE) sub-array? I am not in a multilingual context.


texts:
I have the following markup:

The Father

Born in 1972, a fisherman by trade

</figcapion>

With the Full HTML filter:

The "add line breaks" option adds in lots of superfluous
's
The "correct faulty HTML" means that adding
 and
 sees the caption get chucked outside of the  mangling the layout

The thing is, I like automatic line breaks and I like faulty HTML being corrected, and I don't want my content creators to have to think which filter to use, or have to add in paragraph tags because they decide to use a
 tag.

Is there any module/option that can make these parts of the Full HTML filter work nicely with HTML5?


texts: How do I reset all user passwords to 123 with drush or SQL?

texts:
For testing purposes I like to reset all user passwords to 123.

Is this possible in Drush or SQL?
I guess the query will be someting like this but cannot find the exact yourhash:

UPDATE `<mydatabase>`.`users` SET `pass` = '<yourhash>' ;

Can I run the final query with drush?


texts:
When you have have an image field on a content type, and use the Insert button to place it into the body, do you get a chance to theme it in Drupal 7?  theme_image doesn't seem to get called, and I am not seeing anything the the API refernce.  I know this is JS functionality on the edit page, but there could be ways to still theme it.  Thanks.

Edit for clarification:

When you use Insert to get images into the body, just the image gets inserted and the theme system gets bypassed.  If you use the image as a field, then all modules get a chance to theme it.  This results in inconsistent image usage on a site.

For example, if I use an image as a field, the RDF module will tack on some metadata and my custom theme_image will do its thing.  When I use Insert with the same image, just the plain image gets put in.

On previous projects, I have added some javascript to the theme to fix these discrepancies, but the code needs to be adjusted each time something changes with how images get themed.  Ideally, I am searching for a method to allow images-as-fields and image-inserted-into-body to be themed the same way, without resorting to Javascript or manually editing the images in the body.  If this isn't built-in functionality, I may try to patch the Insert module to allow it.


texts:
I recently moved my website (Drupal 6) and database to a new server. I am now getting an error whenever I try to upload images using the image field. When I upload images the thumbnail doesn't appear and the error I get is:

"ImageMagick reported an error: libgomp: Thread creation failed: Resource temporarily unavailable"

I tried switching to using GD2 but this didn't make any difference. I've also checked that I have the correct temp folder set in the file system. I had migrated from a 1&1 hosting account to a newer 1&1 hosting account...

It seems like the ImageCache files are not being generated.

I'm not sure what to try next.

Any advice would be appreciated.

EDIT:

I also found that even inserting images that are already on the server into content are not showing up. The path is correct (I've checked the files) but they just don't appear.

Actually, hardly any images are showing at all throughout the website even though the paths are correct and when ImageCache is not even used.


texts: facebook change default og:url and canonical URL with metatags module

texts:
I moved my site from HTTP to HTTPS, now a few days later my facebook likes are waaay lower.
For example one article under HTTP was 25K likes now under HTTPS it is 3K likes. I am face with the facebook likes count discrepancy and refer to this page to try to fix it. I removed the og:url content : [current-page:url:absolute] from the metatag config page and manually updated the og:url. I also removed the canonical URL [current-page:url:absolute]  from the metatag as facebook is using it but facebook is still seeing the HTTPS likes  not the HTTP likes for old content.
I also tried http://example.com[current-page:url:relative] without success.
Is there a way in metatag module to have the canonical URL to point to HTTP and not HTTPS by changing [current-page:url:absolute] for canonical URL?
How to make Facebook not see the 301 HTTP Redirect and stick to old url?


texts: How much data is ok to put in the global $user object or $_SESSION variables?

texts: I'm building a site and there are some pieces of information that I am going to use constantly.  My thinking is that instead of making a ton of database calls, that I would put some of these critical pieces of info in the $user object or $_SESSION variables.  The question is, however, how much is too much info in these variables?  Which should I use?


texts: How do I check the current user session?

texts:
In Drupal 7, I was able to use bootstrap.inc in an external PHP script, which was a custom set of pages that simply bootstrapped Drupal to check the user was logged in Drupal.

The following code is a very basic version that just returns the username of an active session.

require_once '../includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
echo $user->name;

I'm looking to implement something similar in Drupal 8. The same script returns a server error.

  Error: Class 'Drupal\Core\Session\AccountInterface' not found in core/includes/bootstrap.inc, line 63

How should I check for an active user session from an external script, in Drupal 8?


texts: View to display content type and media type

texts:
Drupal 8
Say I have 1 content type and 2 media types users can create
Content type: Post
Media Type: Picture
Media type: Movie
How can I create a view that pulls all 3? As far as I can see you can only create views that show content, or media but not both in the same view.
I wasnt to create a feed displaying all 3 types of all users on the site.


texts: Rule on Saving New Comment not triggered

texts:
I want to do some action after saving a news comment which needs comment's CID but I can not do anything after saving news comment!!

I have tested any other actions but none of them triggered by this action.

I have the same problem with the "after updating existing comment".

Only the "before saving comment" action works but I need comment's cid in my code and this value isn't set before saving a comment. So, how can I do my job?


texts: How to re-arrange payment options in the payment checkout page?

texts:
I have several payment options i have enabled in Drupal Commerce. But I do not know how to arrange them in a certain order on the payment checkout page.

I have tried looking out for ways to do this, but failed.

Any idea on how I can do this?


texts: How to expose votings (such as in rate or voting api) to views?

texts:
To avoid the obvious misunderstandings: I know how to display the rate widget in a view, including the vote cast by the user, the average, sum etc. This is not what I'm looking for.

I want a view whose rows are the individual votes cast, with fields containing the information who cast the vote and what it was cast on and how much the rating was. When I create a new view, I can't select this kind of entity.
How can it be done, preferably without code? (If at all)


texts: What can cause user names to disappear from admin pages?

texts:
On an existing Drupal system I see a strange phenomenon; user names disappear from the admin/people page. I've disabled the realname module but still it happens. How to debug such an issue?

Edit: Additional Information

My admin theme is Seven, so I've added a code to print the options array:

function seven_form_user_admin_account_alter(&$form, &$form_state, $form_id) {
  dpm($form['accounts']['#options']);
}

The result: The username fields contains the following typical information:

<a href="/user/322" title="View user profile." class="username"
xml:lang="" about="/user/322" typeof="sioc:UserAccount"
property="foaf:name" datatype=""> </a>


texts:
How can i preprocessor or compile at runtime the LESS files in the latest version of Drupal 8?

I am using the LESS starterkit theme of Bootstrap. The Less CSS Preprocessor is currently not ported to Drupal 8.

The next two guides says that i need NodeJS and the less package to compile it, but it is not at the runtime of Drupal:

lessc less/style.less > css/style.css

Creating a Bootstrap subtheme for Drupal 8
How to build your Drupal 8 theme using Bootstrap & Less


texts: I know this is achievable in Drupal 8 but is there a way to do this in Drupal 7? I've looked into drupal modules, core files but couldn't find anything reliable. I'm asking this because I might want to have a light installation with custom entities and I don't need Node module.


texts:
I am using the Drupal Print module to create downloadable PDF from my site. This works very well indeed. But I would like to have a table of contents in the left region of the downloaded PDF.

For example say, I have Introduction, Chapter2..., these things need to be displayed on the Left side region of my PDF. I had a look at the print module to see whether I can do this with configuration but it didn't work

Any help is appreciated.

Thanks in advavce.


texts:
I have a custom config entity modelled closely on the example documentation and example module.  The example module works fine on my site, my code does not, and I can't see the difference.

What works

Show an empty list of config entities with an add button.
Add a config entity and check it exists via "drush cget".

What fails

In my edit settings form (extends EntityForm), $this->entity has null/default values exactly as if I were adding a new entry.  It does not load the actual entity. It does not perform validation (if I pass a URL /admin/config/content/rrssb/BADPARAM that doesn't map to an existing entity I still see a page, whereas if I do the same test with the example code, I get a 403 error).
In my listing page (extends ConfigEntityListBuilder), if an entity exists I get an error - for some reason the list builder fails to pass the id (machine name) from the entity when building the route.

  Symfony\Component\Routing\Exception\MissingMandatoryParametersException:
  Some mandatory parameters are missing ("button_set") to generate a URL for
  route "entity.rrssb_button_set.edit_form". in
  Drupal\Core\Routing\UrlGenerator->doGenerate() (line 180 of
  core/lib/Drupal/Core/Routing/UrlGenerator.php).

Details

/**
 * Defines the RRSSB button set entity.
 *
 * @ConfigEntityType(
 *   id = "rrssb_button_set",
 *   label = @Translation("RRSSB Button Set"),
 *   handlers = {
 *     "list_builder" = "Drupal\rrssb\RRSSBListBuilder",
 *     "form" = {
 *       "add" = "Drupal\rrssb\Form\RRSSBSettingsForm",
 *       "edit" = "Drupal\rrssb\Form\RRSSBSettingsForm",
 *       "delete" = "Drupal\rrssb\Form\RRSSBDeleteForm",
 *     }
 *   },
 *   config_prefix = "button_set",
 *   admin_permission = "administer rrssb",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label"
 *   },
 *   links = {
 *     "edit-form" = "/admin/config/content/rrssb/{button_set}",
 *     "delete-form" = "/admin/config/content/rrssb/{button_set}/delete",
 *     "collection" = "/admin/config/content/rrssb"
 *   }
 * )
 */

rrssb.routing.yml

entity.rrssb_button_set.collection:
  path: '/admin/config/content/rrssb'
  defaults:
    _entity_list: 'rrssb_button_set'
    _title: 'Ridiculously Responsive Social Sharing Buttons'
  requirements:
    _permission: 'administer rrssb'

entity.rrssb_button_set.add_form:
  path: '/admin/config/content/rrssb/add'
  defaults:
    _entity_form: 'rrssb_button_set.add'
    _title: 'Add RRSSB Button Set'
  requirements:
    _permission: 'administer rrssb'

entity.rrssb_button_set.edit_form:
  path: '/admin/config/content/rrssb/{button_set}'
  defaults:
    _entity_form: 'rrssb_button_set.edit'
    _title: 'Edit RRSSB Button Set'
  requirements:
    _permission: 'administer rrssb'

entity.rrssb_button_set.delete_form:
  path: '/admin/config/content/rrssb/{button_set}/delete'
  defaults:
    _entity_form: 'rrssb_button_set.delete'
    _title: 'Delete RRSSB Button Set'
  requirements:
    _permission: 'administer rrssb'

Help requested

Please can an expert suggest what I'm likely to be missing, or at least help me understand where to look?

In particular, what mechanism (Drupal class/code file) loads the config entry or generates a 403 if it is not found?

The relevant code in my own module spans several files, so I've not pasted it all here, but could upload specific snippets if asked.


texts: D6: Create a new template for a specific url of node type page

texts:
I'm trying to create a completely different template for a page I have set up at:

http://www.example.com/my_page

I thought I just added a new node tpl page (node-my_page.tpl.php), but that doesn't appear to be working. What's the trick?


texts: Submitting Data / Updating Data into Webform programmatically

texts:
I have an existing WebForm in which I want to submit information through a Custom Page. Any idea how I can do that?

Also, there is another page where I want to update couple of fields in the WebForm through sid (submission ID) in a custom page.

Any Idea how to achieve that?


texts:
Last week the Image FUpload module got the "no longer supported" status because "its dependencies swfupload are not maintained and not safe anymore".

Are there any Drupal 6 modules that can replace the Image FUpload module, allowing uploading multiple files/images at once? An HTML5 solution would be great. Thanks!


texts: How to save/map uploaded image in term field of type image with storage location equals s3://

texts:
I'm having 1 field in a taxonomy = 'features' of type image. Image storage location is set to s3.

I have written a hook_form_alter for form_id = article (article is the content type)  where I have created an image field like:

$form['image_dir'] = [
    '#type'                 => 'managed_file',
    '#upload_location'      => 's3://s3-bucket',
    '#multiple'             => FALSE,
    '#description'          => t('Allowed extensions: gif png jpg jpeg'),
    '#upload_validators'    => [
      'file_validate_is_image'      => array(),
      'file_validate_extensions'    => array('gif png jpg jpeg'),
      'file_validate_size'          => array(25600000)
    ],

     ];

Now in my form submission, I'm trying to save/map this image into my term image field (field_vocab_image) . For this, I'm trying something like:

$term = Term::create([
    'name' => $term_name,
    'vid' => 'my_vocab_name',
    'field_vocab_image' => $img,
  ]);
  $inserted = $term->save();

where $img = $form_state->getvalues()['image_dir']; this image is coming from the custom field created in hook_form_alter.

Above code is successfully saving term name but when I go to edit term , image field is empty. Image is not getting mapped.


texts:
I'm converting a WordPress theme. And, yes, I'm following the very good advice listed in a previous question. My question is more granular. So hence, this new question.

Specifically, I'd like to address the menu creation. Should I use the typical theme() functions to build out Main and Secondary menus? What class names should I pass into that theme function?

Currently, I've cleaned up the HTML template by extracting all embedded JS and CSS into external files. It appears as

                home

about

Drop Down 1

Drop Down 2

Drop Down 3

books

movies

time travel

blue box

boats

Or, can I loop over a render variable to produce the
, leaving the
 and
's in place? Does this deviate too far from best practice?


texts: How to create a Views based chart with time intervals and using Highcharts?

texts:
Is there any change to do time interval to Highcharts -module ?

Such as in this example: http://www.highcharts.com/stock/demo/compare

Or do I need to use different module for that?


texts: Migrating Contacts from Joomla to Drupal

texts:
The Joomla module in Drupal does a good job on migrating content and users, but it doesn't have functionality to pull the contacts from Joomla.

Has anyone successfully migrated contacts from Joomla to Drupal? What methods are there of accomplishing this?

I started to manually move the contacts... but there are about 100 of them =/. I started by creating a new content type with the fields for the contact, and am using the Views module to create a table for the contacts.


texts: Programmatically add field collection items to a node

texts:
I have a node with a Field Collection [field_videos]. I would like to be able to progrmatically load a node and add field collection items. The field collection contains the following fields:

field_video_url
field_video_title

How can I achieve this in Drupal 8? The few examples I've seen online are for Drupal 8.1 or 8.2 and don't seem to work in the latest version of Drupal.

My code currently looks like this:

$field_collection_item = FieldCollectionItem::create([
        'field_name' => 'field_videos',
]);
$field_collection_item->setHostEntity($node);
$field_collection_item->set('field_video_title', 'This is my Title');
$field_collection_item->save();

This gives the error: "Error: Call to a member function getEntityTypeId() on null in Drupal\field_collection\Entity\FieldCollectionItem->setHostEntity()"


texts:
I have a date/time field, when I save it as 1:00:00 AM, it displays in the edit form as 1:00 am, however when I do a get of that field value in my module
with $posted_date=$static_media->get('field_pup_posted')->getValue();

, it comes out as`Array
(
    [0] => Array
        (
            [value] => 2017-06-14T05:00:00
        )

)`

Why is it being stored as a 5 when it should be a 1?  and how can i get it programatically in the correct time zone


texts: Displaying individual fields in a template

texts:
I have a template for a specific content type. I want to output individual fields from that content type in a specific order, which requires me to change the content type template. It's too complicated to explain why I need to do this.

In the template I see {{ page.content }} for outputting all the fields together, which displays everything, but I want to take the field variables out of this, and separately display each of them.

So for example I tried the following, but it displays nothing to the page.

{{ page.content.field_field_name1 }}
{{ page.content.field_field_name2 }}

I also tried {{ content.field_field_name1 }}, {{ field_field_name1 }}, and {{ content.field_field_name1.entity }}, but none of them work.

Suggestions?


texts: fill in content creation form based on view

texts:
I have 2 different types of content for users that rely on each other called goals and tasks. The way I have the system set up is that each task must be a part of a goal and this is the view I have set up (through nested accordions):

What I want to do is add a link inside of each goal accordion that says add task and will make a block appear on the screen of this node creation form:

Except that I want the Goal field (which is an entity reference field) to automatically be filled in with the goal that was clicked, and I want the student field to be filled in with the name of the logged in user. My question is if there is a module that can do this, or are there any other ways to do this? Any help is greatly appreciated.


texts: Ajax example dependent dropdown callback

texts:
I have two custom Drupal modules moduleA and moduleB.
moduleA has all the functions for Ajax calls i.e. ajax_example_dependent_dropdown_callback and _ajax_example_get_second_dropdown_options.

I create a content type in moduleB called content_type_b.
I am using Ajax calls in moduleB to populate drop down in content_type_b.

While creating content for content_type_b, I try to choose a value from the drop down.
The first time, it works fine. The second time I get an error saying "An Illegal choice has been selected. Please contact the administrator". All these events happen before a node insert.

When I looked into the logs, the hook_node_validate of moduleA is getting called. The node insert must happen in moduleB. So node_validate of moduleB must be called. I think since the Ajax functions were present in moduleA, the node_validate of moduleA is being called.

Please advice how to proceed in this situation.


texts:
After adding new main menu item I received info that it is created, but it is not. I've check watchdog for some error - none. I've cleared caches. None. I've checked db menu_links - new items are there but magically doesn't shows up. Any ideas? Caches cleared.

Drupal 7.37; PHP 5.3.28;


texts: How to use two base tables in one custom entity Drupal 8?

texts:
base_table = "test_table"

The is the annotation in the custom entity file, is it possible for me to use two tables for the same entity. something like this

 *   base_table = array(
 *     "test_table1" => "test_table1",
 *     "test_table2" => "test_table2",
 *     ),


texts: How do I add a specific meta-tag to all the pages of a site?

texts:
I want to prevent Google from indexing my website. I know I need this meta tag added to the header.

<meta name="robots" content="noindex" />

How can I add this meta-tag to all the pages of a site?


texts: Routing with optional parameters for webform is just giving page not found

texts:
I created my webform to accept parameters via a standard $_GET and this works fine but is quite unsecure I am told and should rather use clean URL's via Drupal 8 built in Routing.

As such I set up a module to support my webform and contains only a info.yml and routing.ynl. The routing is as below, I got the format from Using parameters in routes but suspect I just haven't grasped it.

abc_enquire_form_routing.webform:
  path: /form/enquire/{type}/{region}/{destination}
  requirements:
    _permission: 'access content'
  defaults:
    type: 'tailor-made-holidays'

Normal form access is via http://abcsite.localhost/form/enquire

Form access with parameters as a get (For illustration) was: http://abcsite.localhost/form/enquire?type=tailor-made-holidays&region=asia&destination=48

Module name is: abc_enquire_form_routing

Trying to access the form with the module enabled with the above routing  through http://abcsite.localhost/form/enquire/tailor-made-holidays is simply giving me a p "The requested page could not be found." error. So I can only assume I am doing the routing wrong.

What I am trying to achieve is three optional parameters after the "http://abcsite.localhost/form/enquire" page of the url, e.g. http://abcsite.localhost/form/enquire/tailor-made-holidays/asia/49

Can anyone point me in the direction of a good example of doing this with webforms module ?


texts: How do I get information from build method into render array and rendered?

texts:
I have a region that I need to sometimes render differently, based on a value  in the build method. The build array has the correct information, but by the time it gets the preprocessor its gone and is not rendered.
class ProfileHeader extends BlockBase {
     public function build(): array {
      if ($somethingspecific) {
      $build['content_name'][] = $this->getMobileBlock();
       }
      return $build;
    }
}

Where
  protected function getMobileBlock($X) {
    $info = X::getInfo();
    if ($info) {
      $view_builder = \Drupal::entityTypeManager()->getViewBuilder('info');
      return $view_builder->view($info, 'profile_heading_small');;
    }
    return NULL;
  }

In my template preprocessor
function template_preprocess_header(&$variables) {
   // If I debug here, I wont see my information in the variables and wont be rendered
}

In my block preprocessor
function MODULE_preprocess_block($variables) {
   // If I debug here, I can see the information, but its not rendered
}


texts: Pass an argument to a Rules Action using VBO

texts:
If I create a Rules Action to set the value of a CCK field, and point to that action from VBO, is there a way to add user inputs to the VBO form on the views page to pass parameters to the Rules Action?

I would prefer a way to do this through GUI if possible.


texts:
How can I make which_option required so that users are forced to select an option?

$options = array(
  'Design1' => t('Design 1'),
  'Design2' => t('Design 2'),
);

$form['which_option'] = array(
  '#name' => 'which_option',
  '#id' => 'which_option',
  '#type' => 'radios',
  '#required' => TRUE,
  '#options' => $options,
  '#default_value' => isset($which_option) ? $which_option : NULL,
  '#prefix' => '

If you&apos;re a lucky winner, tell us which bag you would like

',
  '#suffix' => '
',
);


texts:
In Drupal 7, you can put the following code in template.php to add the class 'vr-paragraphs' to the field called 'field_title'

function THEMENAME_form_alter(&$form, &$form_state, $form_id) {
       $form['field_title']['#attributes']['class'][] = 'vr-paragraphs';
}

How can I modify this code to target all fields on the form and not just 'field_title'.

Also, this code only adds the class to the form-wrapper part of the filed. How can I alter the label part?

Thanks for any help!


texts: I'm using Views to override a search administered through Search API. If a search yields no results is it possible to show an alternative set of results? For example, if I searched for "grettrr" and no results were found I'd get the usual "No results found" message, but underneath this message another message that says "Take a look at these instead" would display along with a set of alternative results. These alternative results could be shown based on specified taxonomy terms.


texts: How can I make a custom content entity ID editable on the content entity form?

texts:
I've created a custom content entity with a string ID field named 'lot_number':

*   entity_keys = {
*     "id" = "lot_number",

This is its field definition:

$fields['lot_number'] = BaseFieldDefinition::create('string')
  ->setLabel(t('Lot Number'))
  ->setDescription(t('Unique alphanumeric lot number for a batch of inventory.'))
  ->setRequired(TRUE)
  ->setSetting('max_length', 20)
  ->setDisplayOptions('view', array(
    'label' => 'inline',
    'type' => 'string',
    'weight' => 10,
  ))
  ->setDisplayOptions('form', array(
    'type' => 'string_textfield',
    'weight' => 10,
    'settings' => array(
      'size' => '10',
      ),
  ))
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE)
  ->addConstraint('UniqueField', []);

My problem is that this lot_number field does not show up on the content entity form. I tried adding it to the form programmatically in the buildForm() method of my form controller (that extends ContentEntityForm.) The following code gets it to show up on the form:

$form['lot_number'] = [
  '#type' => 'machine_name',
  '#title' => $this->t('Lot Number'),
  '#weight' => 10,
  '#size' => 20,
  '#maxlength' => 20,
  '#required' => TRUE,
  '#default_value' => $lot_master->getLotNumber(),
  '#machine_name' => [
    'exists' => '\Drupal\galt_inv\Entity\LotMaster::load',
  ],
  '#disabled' => !$lot_master->isNew(),
];

However, when I attempt to submit the form, I get an error message:

Error: Cannot unset string offsets in Drupal\Core\Field\WidgetBase->extractFormValues() (line 354 of core/lib/Drupal/Core/Field/WidgetBase.php).

I tried changing $form['lot_number'] to $form['lot_number']['widget'][0] in an attempt to make it match the rest of the form elements, but that didn't work at all.

Is there some simple way to get a content entity ID onto the content entity edit form? Any advice would be greatly appreciated.


texts: Importing large amount of data slow process with cron and queue

texts:
I am currently importing large amount of data into Drupal and I am using the hook_cron with the queue API and so far everything is working. Data is been imported as nodes and the relationship between them is created and the views are displaying the data properly.

The problem I am having is how long it is the process taking to do the import of the data. I tried using the "Ultimate Cron" to see if a parallel processing of the cron job will speed things up, but I had no luck.

I have my queue full of pending data to be process and I can think of a way to speed it up. I read about creating multiple queues, but I haven't try that.

The server is a pretty decent server and the server load is less than 2% all the time, swap is empty and I am only using 800MB of 16 GB of RAM.


texts: Why does drush en node_clone end up in a circle

texts:
this pretty much says it all:

drush en node_clone
node_clone was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                                             [ok]
node_clone
Would you like to download them? (y/n): y
Install location /xxx/sites/all/modules/node_clone already exists. Do you want to overwrite it? (y/n): y
Project node_clone (7.x-1.0) downloaded to /xxx/sites/all/modules/node_clone.                            [success]
Project node_clone contains a module named clone.
node_clone was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                                             [ok]
node_clone
Would you like to download them? (y/n): y
Install location /xxx/sites/all/modules/node_clone already exists. Do you want to overwrite it? (y/n): n
Skip installation of node_clone to /xxx/sites/all/modules/node_clone.                                    [warning]
node_clone was not found.                                                                                [warning]
The following projects provide some or all of the extensions not found:                                                                             [ok]
node_clone
Would you like to download them? (y/n): n


texts: How to use conditions on a REPLACE expression?

texts:
For an autocomplete, I'm searching a table of address (full address in one column).

Example: 123 Example building, Somestreet, Town, QW1E 2RT

To improve the search I want to remove the space, so you can search QW1E2RT or QW1E 2RT, however, I obviously don't want that to be displayed to the user.

I think I'm most of the way there:

$query = \Drupal::database()->select('mctable', 'mc');
$query->addField('mc', 'a_address');
$query->where('REPLACE(mc.a_address, \' \', \'\') LIKE \':value\'', [':value' => '%' . $string . '%']);
$query->distinct();
$rows = $query->execute();

The problem is that the :value placeholder doesn't appear to be passed through… If I hardcode a value in the "snippet" it works.

I originally tried with:

$query->addExpression('REPLACE(mc.a_address, \' \', \'\')', 'a_address');
$query->condition('a_address','%' . $query->escapeLike($string) . '%', 'LIKE');

But couldn't figure out how to use the expression in the condition.

Many Thanks for reading and helping.


texts:
i have some block with sorting exposed filter on region "tab" and i show his in node.tpl like this:

print render(block_get_blocks_by_region('tab'));

In my block i not have any problem with AJAX in paginator. But my sorting exposed filter not work at all.

After several hours testing i figured out what my block works ( AJAX sorting filter + paginator) if i show his in any another region on page.tpl.

That things i see in header, if show his through any region on page.tpl:

  "better_exposed_filters":{"datepicker":false,"slider":false,"settings":[]},"views":{"ajax_path":"/views/ajax","ajaxViews":{"views_dom_id:7ff6de2549b84f9553122b84f32d822b":{"view_name":"person_books","view_display_id":"block_1","view_args":"61/61","view_path":"node/61","view_base_path":null,"view_dom_id":"7ff6de2549b84f9553122b84f32d822b","pager_element":"0"}}}

That things i see in header, if show his through region "tab" in node.tpl:

  "better_exposed_filters":{"datepicker":false,"slider":false,"settings":[]},"views":{"ajax_path":"/views/ajax","ajaxViews":{"views_dom_id:21d228e5cc07884c39ecda6d29b417c4":{"view_name":"person_books","view_display_id":"block_1","view_args":"61/61","view_path":"node/61","view_base_path":null,"view_dom_id":"21d228e5cc07884c39ecda6d29b417c4","pager_element":"0"},"views_dom_id:a94bccf7913b478becb33a3a27ec903d":{"view_name":"person_books","view_display_id":"block_1","view_args":"61/61","view_path":"node/61","view_base_path":null,"view_dom_id":"a94bccf7913b478becb33a3a27ec903d","pager_element":"0"},"views_dom_id:da94f68eea44bf9ead4034e965977935":{"view_name":"person_books","view_display_id":"block_1","view_args":"61/61","view_path":"node/61","view_base_path":null,"view_dom_id":"da94f68eea44bf9ead4034e965977935","pager_element":"0"}}}

How can i fix it? Why views send many view_dom_id in header if i show my block through region in node.tpl?

P.S. i tryed show views through views_embed_view in node.tpl - same things, not helped me :/


texts: Captcha on login form using the form block module

texts: I am providing the registration form using the form block module. I also have Captcha and Hidden Captcha module enabled on mysite. However i am not getting the option to add a captcha to the registration  form which is coming from the Form Block Module. How can i do so...i tried to find the form id of this registration block (form the form block module) but was unable to do so. Any help would be appreciated.


texts: Two 'add to cart' buttons using different attributes

texts:
I am using Ubercart 3 on Drupal 7 for my website.

How am I able to have two "Add to cart" button on a product page that use two different attributes? So for example I can have:

(Buy the large version)
(Buy the small version)

Those two buttons match my attributes that I have set in the back, so customers can click on one of those and add the product to the cart directly.


texts: Filter a view based on current user's roles

texts:
I'm using a view to populate an Entity reference field on a profile. (So it's a view of "Entity Reference" display type.)

I want to filter this view to show (and allow users to select) only:

Published content (OK)
Content of a certain type (OK)
Only a subset of nodes available to the current user (OK)
If the current user is admin or some other role, bypass the previous filter (3) and show all nodes (but still respect filters 1 and 2) (not OK)

Filters 1 and 2 are always mandatory; then either filter 3 or 4 must also be mandatory. I've tried to rearrange filters into filter groups to make this work, but I cannot find a way to build filter 4.

For filter 4, I need to filter based on the role of the current user (NOT author), and I cannot find how to do that.

I'm looking for a Relationship to bring in the current user data (something like "User: current"), and then filter on that data, but where can I find that?


texts: How to set destination URI when migrating files

texts:
I have the following case:
I'm trying to migrate Drupal 6 profile pictures into Drupal 8 file_managed table. All goes fine except that I'm unable to set new destination URI for column file_managed.uri.

The old picture is stored as full path to file in column users.picture as following: "sites/default/files/pictures/picture1.jpg".

However, I want to change it when importing into the D8 site.

I tried using $row->setDestinationProperty method, but it fails to register and the migration continues as usual and I just get full image location instead.

So the question: How can I set the new destination URI during migration?

Full code:

 <?php

/**
 * @file
 * Contains \Drupal\md_migrate\Plugin\migrate\source\UserProfilePicture.
 */

namespace Drupal\md_migrate\Plugin\migrate\source;

use Drupal\migrate\Plugin\migrate\source\SqlBase;
use Drupal\migrate\Row;

/**
 * Extract files from database.
 *
 * @MigrateSource(
 *   id = "md_migrate_user_profile_picture"
 * )
 */
class UserProfilePicture extends SqlBase {

  /**
   * {@inheritdoc}
   */
  public function query() {
    return $this->select('users', 'u')
      ->fields('u', array('picture'))
      ->condition('u.picture', '', '!=')
      ->orderBy('u.uid', 'ASC')
      ->range(0,1);

  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    $fields['picture'] = $this->t('File path');
    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getIds() {
    return array(
      'picture' => array(
        'type' => 'string',
        'alias' => 'u',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    parent::prepareRow($row);
    // Get filename property value.
    $filename = $row->getSourceProperty('picture');

    $new_filename = explode('/', $filename);
    $new_filename2 = end($new_filename);
    // Prepare base path.
    $base_path = trim($this->configuration['source_base_path'], '/');
    // Set "full_path" property to point to the full path of the image.
    $base_module_path = drupal_get_path('module', 'md_migrate');
    $row->setSourceProperty('full_path', $base_module_path . '/' . $base_path . '/' . $filename);
    $row->setDestinationProperty('uri', 'public://pictures/'.$new_filename2);
  }

}


texts: I ve used MetaTag module to change the tags in my node . but this changes me to all nodes. I want different tags for different nodes Is there any possiblities to do so?


texts: Migrate module. Users from D6 to D7 with preserved UIDs

texts:
I'm trying to migrate a Drupal 6 site to a totally new implementation of Drupal 7.

I'm using the migrate module, and I am able to successfully migrate users and passwords, as well as their roles, but the users UIDs is not being maintained.

I believe that the issue is that UIDs must be explicitly set on the user object before saving it, and migrate is not doing that for me.

http://drupal.org/node/712966

Any tips on how I can do that? I need my UIDs on Drupal 7 to be exactly the same as Drupal 6!


texts: How do I use a theme hook suggestion in template.php?

texts:
How do I convert a theme hook suggestion into a function in template.php?

Here is an example I pulled using TEMPLATE_preprocess_field() with dpm().

What would I name my function in template.php to utilize field__field_video_virtual_tour__basic_drealty_listing, and where can I find the default theme function for a text field to use?


texts: REST resource for specified content type

texts:
Drupal 8 has a REST resource for all content type "Content" and let us to specified settings for all of content type in admin/config/services/rest/resource/entity%3Anode/edit ,but is globally, I mean if let users post data to Content type, they can Post data to all of  content types  and(But what I need is I don't let them to do this), I didn't find any option to restrict to specified content type.

I also take a look at permission and  RESTful Web Services permission is for "Access POST on Content resource" and there is not any option for content types individually.

I want to know how can achieve this that REST POST feature exists for specified content type(s) and for some content type GET exists and for some content type REST not allowed?

Update(more deatils about what I want)
I want anonymous user can POST  contenttype1 content with REST ,
I give permission to anonymous user to  create contenttype1 content, and
Authentication providerssection I checkcookieandbasic_auth`  methods, but when try to post data with following code it told me authentication required
(I ran this snippet  in browser console )

(function($){

                    jQuery.ajax({
                        url: '/rest/session/token',
                        method: 'GET',
                        success: function (token, status, xhr) {
                            var postData = {}
                            postData.title = [{'value': 'My Basic Page'}];
                            postData.field_enroll_email = [{'value': 'zhilevan@gmail.com'}];
                            postData.type = 'enroll';
                            jQuery.ajax({
                                url: "/entity/node",
                                method: "POST",
                                data: JSON.stringify(postData),
                                headers: {"Accept": "application/json", "X-CSRF-Token": token, "Content-Type": "application/json"},
                                success: function (data, status, xhr) {
                                    console.log(data);
                                }
                            });
                        }
                    });
})(jQuery);


texts:
Is it possible to use OR in arguments?
I have content types "Sport Match" and "Sport Team". "Sport Team" can be in "Host" field or in "Guest" field of Sport Match (node reference).
How can i make view containing all "Sport Match" for one "Sport Team"? I would like to display such view on every "Sport Team" node. So i'm thinking that simple two arguments with OR would to the trick.

I would like to get NID of current "Sport team" node and pass it to arguments filter which will looks something like this:

field_host = NID

OR

field_guest = NID

Is there way to do this in views?

In SQL this is easy, can anyone point me how alter view so I manualy insert OR filter.

Or some other idea how to do this?

(I'm using D6 and Views 2)


texts:
I'm using devel to find specific fields I'd like to be able to access in a template I have for a user profile page (user-profile.tpl.php)

The field values are present in devel just fine however I'm not sure what to do with the path it gives me.

I see the info I need, (created = 1349810890)
and I see a path that devel has given me $...->created but I'm not sure what to replace $... with to get access to that field.

I've attempted the following

$node->created;
$page->created;
$user->created;
$node['created'];
$content->created;
$variables->created;
$variables->node->created;

And several others with no luck


texts: Drupal 7 Media Gallery Extra stopped working

texts:
I am using such modules as Media, Media Gallery and Media Gallery Extra (with Media Gallery Directory inside) in my Drupal 7 for creating of galleries. Straight after installing everything worked perfectly. There was created about 10 galleries, media was successfully uploaded in different directories (*sites/default/files/galleries/NAME_OF_THE_GALLERY/...*).

After few days (I haven't tracked the reason unfortunately) the functionality of the module has stopped operating: all the media created via Media Gallery were uploading into the default path (sites/default/files/). The same result is on the server under Ubuntu and local copy under Windows (so I guess there are no problem with file/dir permissions).

The configuration of the module is still the same. The module files have not been changed. Disabling/enabling of the module doesn't fix the problem. It only can be fixed by re-installing of the media_gallery_directory, media_gallery_extra and media_gallery modules. But in this case all the media files/comments/galleries are removed. So this is not my option if to take into account that there are already about 150 galleries have been uploaded to a production site.

I've tried to manipulate with some db config fields on my development environment - but everything is unsuccessfully.

How can I fix this issue? Any comments are deeply appreciated.


texts: What's the difference between "content menu links" and "menu links"?

texts: I am using Features module to export menus and related links. In my Drupal installation I have both "content menu links" and "menu links" available to insert in a feature. What is the difference? They seem to work both.


texts: Paid node checkout plus membership plans for a Drupal site

texts:
I need a solution to these problems for Drupal 7:

I need to create a website where people can post their classified ads. But the twist is that I don't want the ads to be published until the user has paid for it.

Also I need to create a membership plans per role (E.g. Gold Plan, Silver Plan, etc. for monthly subscription)

Now I have tried a few things like:

I tried using lm_paypal for this purpose. But the issue with lm_paypal is that it does not publish the node after the payment has been made.
The admin has to manually check the paypal IPN and publish the content if the node has been paid for. I do not know module development so I am not able to make these small tweaks.
I tried using ubercart too but the standard issue rises again. The uc node checkout module is still in the dev version for drupal 7 and it works like hell. So many errors :(

So can anybody please come up with an alternate solution where I can achieve both the "Pay to publish" and "Membership plan" functionality on my Drupal 7 site?


texts: Slow localhost Drupal websites and drush

texts:
I installed XAMPP on a new laptop to use it for Drupal. All the websites on my localhost are extremely slow, even a brand new vanilla Drupal website. It takes 5-10 seconds to go from one page to the other with a message at the bottom left corner of "Waiting for localhost".

I tried a lot of configuration adjustments but nothing worked. Things like:

disabled XDEBUG
enabled Opcache
increased/modified php.ini settings:

memory_limit, max_execution_time etc...

increased/modified my.cnf settings:

max_connections, wait_timeout, innodb_ etc...

edited the 'hosts' file found here: C:\Windows\System32\drivers\etc by uncommenting # 127.0.0.1 localhost
turned off the Firewall etc..

and a lot of other things that i didnt document...

DRUSH cc all also takes like 1 minute.

When navigating between pages of a local drupal website, the mysqld.exe service goes all the way to 3Mb/s and usage of over 95% in the Task Manager.

i feel that it's a mysql issue, not an apache but at this point im not sure anymore.

Does anyone have other ideas?


texts: Latest added data in a particular contenty-type on custom page

texts:
I am a newbie in Drupal,I have content-type "News" where the user adds news related to product. I want to show the latest 3 added news on content-type "Home-Page" (Home-Page is not front page).

What would be the standard way to get the desired output?

**I am using Drupal7


texts:
I have searched the answers on this site and have found threads like
    Configuring the temporary directory which refer to this issue but could not arrive at a solution. My setup is Linux (Fedora), Apache, PHP 5.4.22 with Drupal 7.24 and I've done the following to ensure a correct configuration of the Drupal file tree:

1) chown -R apache:apache Drupal
2) cd Drupal
3) mkdir tmp
4) chmod 777 tmp
5) Change temporary directory in drupal admin/config to "tmp"

When I try to install a module (either through direct file upload or via URL) I get the error:

Module Installation: Unable to create directory 'temporary://update-extraction-f781a69c/

Now, the curious thing is that when I look in Drupal/tmp I see the following:

[root@localhost tmp]# ls -l
total 1448
-rw-rw-r-- 1 apache apache 1476650 Dec 13 23:24 bcommerce.tgz
drwxr-xr-x 2 apache apache    4096 Dec 13 23:24 update-extraction-f781a69c

So the extraction folder is created and seems to have proper ownership and permissions yet I'm still getting this error.

I've also ensured that the files in my tgz archive have proper permissions and are owned by apache, so their permissions should also be OK.

Any ideas on what might be wrong here would be much appreciated; I've been banging my head against this issue for a few hours now and have gotten nowhere.


texts: Media queries only applied for authenticated users

texts:
i'm working on a responsive theme using compass / susy, and i had issues on application of media queries.For example, images weren't responsive on mobile, or weren't on full size for desktop.
i did test on different browser and the only one that work were one for connected user.so i did connect me under others browser and media queries were applied.
so what can i do to fix this uge problem ?

thanks


texts: using drush php-eval db_query() are there differences with db_query() from code?

texts:
I think the answer should be easy but I can't find it.

maybe I've been put in the wrong direction finding sites telling how to clear my flood table like so:

drush php-eval 'db_query("DELETE FROM `flood`");'

But I think is should be like this so it also works for prefixed tables:

drush php-eval 'db_query("DELETE FROM `{flood}`");'

Or does db_query() works different in drush php-eval?
As far as I know it just executes php but does it has the drupal 'library' available or not?

Now I could just try and see what happens but I think it's good to really know if there's a difference or not in running db_query() from drush or from code.


texts:
I have a website with a product catalog of more than 500 products.
I'm using Drupal Commerce and have created a product display content type to group several SKUs under a single product page.

I'm using the i18n module because I need a multilingual website.

Once the data entry is done (for the English section), the catalog must be totally translated into all the other languages, and that means a huge amount of work. Can this step (translation of product display contents) be automated in any way?

Please note: I just need all the products to be visible in all the active languages, at present there are no "string" product fields to translate.

Edit

By "automated" I mean that I start from creating product display pages in one language, and then I need product display pages in each of the defined languages; I'm looking for an automated way to create product display nodes in other languages instead of having to manually translate each page.

I've accepted the answer below because it does provide a solution to the problem and it's not a workaround, anyway it's not the way I took.

How I made it work

I set product display pages as language neutral.
I translated all the product page fields' labels, and then all the select lists' values.
At that point, I was faced with an hybrid page, with translated labels and untranslated values. I wondered why, until I found this page, mentioned in this post. That is, I...
went to Administration > Structure > Content types.
Click on Product page > Manage display.
Set format to Default translated, Link (localized) or Plain text (localized) depending on the field type.