texts: Configuring drush alias for rsync with exclude paths and file patterns

texts:
I tried adding exclude paths and file patterns to my drush alias; it didn't work, but adding the filters with --exclude= in the command works.

drush rsync --exclude=imagecache/* --exclude=ctools/* --exclude=js/* --exclude=tmp/* --exclude=xmlsitemap/* --exclude=*.doc* --exclude=*.DOC* --exclude=*.pdf* --exclude=*.PDF* --exclude=*.ppt* --exclude=*.PPT* --exclude=*.zip --exclude=*.ZIP --exclude=*.xls* --exclude=*.XLS* @sitename.live:%files @sitename.local:%files

(I wanted to create the directories but skip the contents)

I looked at a similar question but I'm not sure what I am doing wrong.

The docs for drush core-rsync explain:

  --exclude-paths List of paths to exclude, seperated by : (Unix-based systems) or ; (Windows).

here is what I tried:

$aliases['live'] = array(
  'root' => '/var/www/[domain]/htdocs',
  'uri' => '[site uri]',
  'remote-host' => '[host ip]',
  'remote-user' => 'rgoya',
  'path-aliases' => array(
    '%files' => 'sites/default/files',
  ),
  'command-specific' => array(
        'sql-sync' => array(
            'no-cache' => TRUE,
        ),
        'rsync' => array (
            'mode' => 'rlptDz',
            'exclude-paths' => 'css:imagecache:ctools:js:tmp::xmlsitemap',
            'exclude' => '*.tmp',
            'exclude' => '*.doc*',
            'exclude' => '*.zip',
            'exclude' => '*.xls*',
        ),
    ),
);

I also tried 'mode' => 'azv'

Also, can I use regexp in the exclude patterns? some extensions are lowercase, some are uppercase .pdf / .PDF


texts:
I am trying to select a bunch of users with a bulk operation so I can delete them and unpublish their comments. I have a comma separated list of about 250 users. However, when I use the filter command in views, it only lets me enter about 10 names before the form runs out of space.

Is there something I am missing here? How do I create a filter that will take a much longer list of names? and/or just pass in a CSV file?


texts: Making contextual node paths and reference lists

texts:
First off, I am about to set up a site presenting a catalog of products. Since it's quite possible that at some point we'd open a store, I decided to use Commerce Product Display right from the start to present the products, assuming that it will be much easier to migrate to a real shop when we're ready. (Is that assumption correct?)

Now, each product will be tagged using two independent taxonomies (ie. each Display Product will have 2 taxonomy fields). That's because each product has two contexts possible: how it's built and how it can be used. The context will depend on the path user takes at the front page or the link they paste into the browser.

The issue I'm facing is that for each product I want to generate a list of related products, depending on the context.

Two questions now:
1. Is it possible to display a given Product Display page with different contextual path/breadcrumbs?
2. In a Product Display page, what module would you use to present a list of related products: Node Reference or Views Field?

Whatever you may have experience in setting up similar sites, I would be more than curious to hear from you, to learn about the precautions and caveats.


texts: Include third party JS library into my drupal module

texts:
I want to include this library into my drupal module. Now I have two problems.

I wanted to use composer manager to get this library, but it's not available on packagist.org. So, I've tried to put it there manually to do not stuck on it. Path is MY_DRUPAL/vendor/malsup/jQuery.blockUI/jquery.blockUI.js
I want to attach this library via hook_page_attachments, but seems I don't know how to define this library in libraries.yml. The problem is that I cannot specify path to folder vendor/ from my_module.libraries.yml, because vendor/ located in root of drupal.

Could somebody give me an advice?

Thanks in advance.


texts: Mediawrapper not removed from the content added though ckeditor from Media module?

texts:
I have added image/video into ckeditor using Media module.There is a media wrapper tag around img tag when i click the source.But when i save it and view it in the node the output is as below

          <mediawrapper data="">

             <picture class="media-element file-article-page" data-fid="254" data-media-element="1">
              </picture></mediawrapper>

    <source media="only screen and (min-width: 1300px)" srcset="http://mdm.dev.local/sites/default/files/styles/story_main_imgbreakpoints_theme_mdm_theme_wide_1x/public/Satwinder-Singh-Bh.jpg?itok=Xa2QkiIM 1x">

&nbsp;

<source media="(min-width: 980px)" srcset="http://mdm.dev.local/sites/default/files/styles/story_main_imgbreakpoints_theme_mdm_theme_normal_1x/public/Satwinder-Singh-Bh.jpg?itok=4-_MEyLT 1x"><source media="(min-width: 740px)" srcset="http://mdm.dev.local/sites/default/files/styles/story_main_imgbreakpoints_theme_mdm_theme_narrow_1x/public/Satwinder-Singh-Bh.jpg?itok=Ix6a8-i4 1x">

<source media="(min-width: 320px)" srcset="http://mdm.dev.local/sites/default/files/styles/story_main_imgbreakpoints_theme_mdm_theme_mobile_1x/public/Satwinder-Singh-Bh.jpg?itok=GawXXe4L 1x">

Image has picture tag but it is seperated and only the image with img tag is shown instead of all picture element together.Also the Media wrapper are not converted.I have enabled "Convert Media tags to markup" in text formats.What else do i need to get the picture tag work along with media module?


texts: User ID problem when programmatically creating nodes

texts:
I have written a migration script that migrates data from Drupal 4.7 to Drupal 6. It is highly customized for my purposes. I am able to create new nodes with no problem. However, after I save the nodes I am noticing that the user that created it is showing up as "Anonymous" and in the database it has a uid of 0. Yet, when I wrote my code I have set it to 1 when the migrated user id has not been found. I have even double-checked to make sure that it is setting the uid to 1.

Why would this be setting it to uid = 0 when I specifically set it to 1?

  $node = new stdClass();
  $node->type = 'opinion_article';
  $node->title = $blog->title;
  $node->body = $blog->body;
  $node->teaser = $blog->teaser;

  //We need to associate the content to the user that created it.
  $node->uid = 1;
  $node->name = $account->name;
  $node->status = $blog->status;
  $node->comment = $blog->comment;
  $node->promote = $blog->promote;

  //Set a default topic of Migration Data.
  $node->field_topics[] = array('nid' => 820); ###### Remember to update this node ID to reflect the topic nid on dev once created. It is nid 916 on the dev server.  ################

  //Set the parent group
  $node->og_parent = $parent_nid;

  //Create the node
  $node = node_submit($node);
  node_save($node);


texts: Drupal Ubercart to Commerce Migration: any solution for uc_file (file downloads)?

texts:
I've recently upgraded a Drupal site from 6 to 7, and now want to migrate from Ubercart to Drupal commerce. The Ubercart upgrade has been completed already just in case.

Ubercart has a module called uc_file that allows files to be assigned to products.

The module has three tables:
1. uc_files: contains the file id (fid) and the name of the file
2. uc_file_products: contains fid, feature product id (fpid), something called pfid, and some other fields for the description, etc.
3. uc_file_users: contains fid, uid, fpid, fuid (?), and other fields.

Has anyone migrated these tables, and if so, what approach did you take? The most important data I need to migrate is the actual line item purchases, so the users will be able to access their purchased downloads.

I have commerce_migrate_ubercart installed, but it doesn't appear to handle the Ubercart File Downloads, which is the entire store.


texts: Is it safe to use $_SESSION to store temporarily a user provided value under multi-step form processing

texts: I have a form which contains an AJAX button press callback. Upon pressing this AJAX button, I want to store temporarily a form element's value before fully processing all the data upon pressing main form submimission button. On the meanwhile, how do I store that particular field value? Is it fine to achieve this using $_SESSION? Is this secure? Does it work flawlessly under Drupal 7, or is there a better alternative?


texts: What is the difference between \Drupal::request()->getSession() and \Drupal::service('user.private_tempstore')?

texts:
As the title suggests, I'm a bit confused about those two methods of creating and accessing a session on Drupal 8. I'm not quite sure when to use the one over the other, could someone point me to the right direction?

My issue started after a Drupal update, where originally I was using this way to start a session for anonymous users on my module:

$request       = \Drupal::request();
$this->session = $request->getSession();

$session       = $this->session->get('mymodule');

After the update, the above code won't create a session for anonymous user and the only way to make it work was this piece of code:

$tempstore = \Drupal::service('user.private_tempstore')->get('mymodule_name');
$tempstore->set('my_variable_name', ['test var' => 'this is my value']);

echo '<pre>';
print_r($tempstore->get('my_variable_name'));
echo '</pre>';

So, even though I've managed to make it work, I'm not quite sure why it did work that way.


texts: How to display the total number of article/page on a term views?

texts:
In Drupal 7. We created a Views to list all pages assigned to this particular TermA. But some of these pages can only be view by registered user. We would like to show the total number of pages in this TermA, so un-registered user know how many articles/pages they are missing without register. So how can I display the total number of pages in this TermA in View(not the term menu link)? It will be nice to show that number next to(or under) the Views title(see screenshots).

Current setting on views and display

wanna have total number of articles in this TermA like this


texts: Why EVA display of views is added to the manage display of content type?

texts:
There are three related content types in my website: article, sub-article, number-article. there is an entity reference from number-article to the sub-article and an entity reference from sub-article to the article. There are two views that displays these relations and in each one there is an EVA display. in the manage display of sub-article content type I saw this:

content of numberarticle is set to all content types, so why a display if view is added to a content type and how does Drupal find out where it should be?!


texts: How can I dynamically refresh the price on product page when changing quantity based on price table

texts:
I'm currently building a web store with Drupal commerce and would like to get to price shown on a product page to asynchronously refresh when the user increases the amount in the quantity field, such as here.

How can I achieve this?


texts: Not able to navigate through different sections of administrator page of fresh installed drupal 7.14

texts:
At the first instance after finishing installation the link "Go to your new website" directs to the parent directory.
Then I tried with appending "index.php" to "http://localhost/drupal/" it displayed admin home but now Clicking on any link displays the root directory of drupal site.
I am not able to navigate through different sections of administrator page of drupal.


texts: Intermittent hook_menu error - call_user_func_array() expects parameter 1 to be a valid callback

texts:
As the title suggests I'm getting intermittent errors when hook_menu is called. Based on the error message it's as if the callback can not be found. Clearing the cache resolves the issue and the page works as expected. However, if the server is idle the error reappears. Any ideas as to what might be happening? Here are some details:

Error as reported in log:

  Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_protected_download' not found or invalid function name in menu_execute_active_handler() (line 517 of /var/www/drupal/includes/menu.inc).

All code is in the my_module.module and the module is enabled:

function my_module_menu()
{
    $items = array();
    $items['lesson-register-for-download'] = array(
        'path' => 'download/register',
        'title' => t('Register to Download a Lesson Plan'),
        'title callback' => FALSE,
        'access callback' => TRUE,
        'type' => MENU_CALLBACK,
        'page callback' => '_protected_download',
    );
    return $items;
}

function _protected_download()
{
    // check cookies and redirect here
}


texts: Get node_type entity for default value in form

texts:
I'm attempting to allow users to enter a number of node types in an entity reference field inside a custom config form. However I can't seem to supply it with a proper default value. My field in the form looks like this:

$config = $this->config('contentform.settings');
    $form['content_types'] = [
        '#type'          => 'entity_autocomplete',
        '#description'   => t('Choose what content types to map'),
        '#target_type'   => 'node_type',
        '#default_value' => $config->get('content_type'),
    ];

However $config->get('content_type') only supplies me with the label of the content type.

So I get the following error

  InvalidArgumentException: The #default_value property has to be an
  entity object or an array of entity objects

I'm saving the value in the submit function like so:

    $content_type = $form_state->getValue('content_types');
    $this->config('contentform.settings')
         ->set('content_type', $content_type)
         ->save();

I've also tried $form_state->get('content_types') and $form_state->get('content_types')->entity; But those didn't work either.

How would I get the node_type entity or object instead of just the label? Or is there a way to load the node_type from just the name?


texts:
I am using Drupal 8 and I am trying to display a map of a Geofield field, using Leaflet. This part works as expected when I manually enter coordinates into the Geofield.

But problem comes with the geocoding part : I set up a File field to store a KML file. When the Geofield is told to geocode from the KML file field, each time I create or modify a content, two messages are shown :

a warning about the fact the file "cannot be geocoded",
an error saying that Drupal "could not find geo data in file" xxx.

Checking the Drupal log adds an interesting information : there is a php warning with a huge message starting with :

  Warning : exif_read_data(test.kml): File not supported in Drupal\geocoder\Geocoder\Provider\File->geocode()

The problem may come from the Geocoder plugin I use for the Geofield geocoding : I can select several plugins in the field management section, all of them apparently dealing with address geocoding, except a "File" plugin. I tried to check only this latter, or all, with the same failing result.

I thought the 'File" Geocoder plugin would be able to deal with KML, GPX... but it may be only for pictures shot containing exif data. Is there a specific plugin for KML files ? And what is the way to make it appear in the Geofield management ?

Anyway, I have tried for hours to find a solution, without any success for any file types (KML, GPX...).

Any help would be greatly appreciated.

Regards,

Remi.


texts: Why are DIVs in the wrong order in Zen theme

texts:
I'm guessing (hoping) there is a good reason that the DIVs in the Zen theme are in reverse order.

In "Main", the natural order should be Banner, Navigation, Content. Instead the template is rendering them backwards and then using CSS to re-order them in the correct position.

Why?  It is causing me massive grief.

I should point out that the "Banner" DIV is my own customization of the theme. It actually shows up in the correct natural order. So - really the issue is why is Content rendered BEFORE Navigation?  Doesn't make logical sense; is there a technical reason?


texts: Why file attachment has different URLs in icons links and default link on node page?

texts:
I have node with attached file. Node attachments view look:

sample.pdf link has url like sites/default/files/sample.pdf. I can download file via this link.

Links with icons has URL like download/file/fid/[id]

I can't download some of files via icon links (403).

How can I change this behaviour? I want those links point to `sites/default/files/sample.pdf


texts: Allow users to edit just the vocabulary that belong to them?

texts:
I allow users to create a taxonomy vocabulary. Then I need to be able to give permission to each user to edit their own vocabulary. I looked at the permission page but I don´t see anything like Edit own vocabularies.

Is there any way I can accomplish this.

Thanks.


texts: How to make Drupal Commerce send email notification to the author of products sold?

texts:
I use Drupal Commerce and the rules module to send email which works OK. But it doesn't send the email to author node of product.

Here is an export of my current rule:

{ "commerce_checkout_order_email" : {
    "LABEL" : "Send an order notification e-mail",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "4",
    "OWNER" : "rules",
    "TAGS" : [ "Commerce Checkout" ],
    "REQUIRES" : [ "rules", "mimemail", "commerce_checkout" ],
    "ON" : { "commerce_checkout_complete" : [] },
    "DO" : [
      { "mimemail" : {
          "USING" : {
            "key" : "emailrenzo",
            "to" : "[commerce-order:mail]",
            "from_name" : "Regalalo",
            "from_mail" : "info@regalalo.pe",
            "subject" : "Pedido # [commerce-order:order-number] en [site:name]",
            "body" : "\u003Cdiv\u003E\r\n\u003Cimg src=\u0022\/http:\/\/34.214.32.99\/sites\/default\/files\/logo-regalalo.png\u0022\u0022\u003E\r\n\u003C\/div\u003E\r\n\r\nHola [commerce-order:owner]!!\r\ngracias por realizar un pedido en [site:name], su n\u00famero de pedido es # [commerce-order:order-number].\r\n\r\nSi este es su primer pedido con nosotros, pronto recibir\u00e1 otro correo electr\u00f3nico con las instrucciones para acceder a nuestro sitio con su nombre de usuario y contrase\u00f1a. Puede ver su historial de pedidos en cualquier momento ingresando a nuestro sitio web:\r\n\r\n[site:login-url]\r\n\r\nPuede consultar el estado de su pedido en:\r\n\r\n\u003Ctable cellspacing=\u00220\u0022 cellpadding=\u002210\u0022 border=\u00221\u0022\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ctable cellspacing=\u00220\u0022 cellpadding=\u002210\u0022 border=\u00221\u0022\u003E\u003Ctr\u003E\u003Ctd\u003E[commerce-order:commerce_line_items]\u003C\/td\u003E\u003C\/tr\u003E\u003C\/table\u003E\u003C\/td\u003E\u003C\/tr\u003E\u003C\/table\u003E\r\n\r\n[commerce-order:customer-url]\r\n\r\nPor favor comun\u00edquese con nosotros si tiene alguna duda.\r\n\r\n\u00a1Gracias por comprar en nuestra plataforma! Vuelve a visitarnos aqu\u00ed: Regalalo.PE\r\nSi tienes alguna pregunta acerca de tu pedido, contacta la tienda del producto que tendr\u00e1 el agrado de atenderte. \r\nPara otra consulta de asistencia env\u00edanos un correo a \u003Ca href=\u0022mailto:info@regalalo.pe\u0022\u003E info@regalalo.pe\u003C\/a\u003E\r\n",
            "language" : [ "commerce-order:state" ]
          },
          "PROVIDE" : { "send_status" : { "send_status" : "Send status" } }
        }
      },
      { "mail" : {
          "to" : [ "commerce-order:owner:mail" ],
          "subject" : "Pedido # [commerce-order:order-number] en [site:name]",
          "message" : "Hola [commerce-order:owner]!!\r\nGracias por realizar un pedido en [site:name], su n\u00famero de pedido es # [commerce-order:order-number].\r\n\r\nSi este es su primer pedido con nosotros, pronto recibir\u00e1 otro correo electr\u00f3nico con las instrucciones para acceder a nuestro sitio con su nombre de usuario y contrase\u00f1a. Puede ver su historial de pedidos en cualquier momento ingresando a nuestro sitio web:\r\n\r\n[site:login-url]\r\n\r\nPuede consultar el estado de su pedido en:\r\n\r\n[commerce-order:commerce_line_items]\r\n\r\n[commerce-order:customer-url]\r\n\r\nPor favor comun\u00edquese con nosotros si tiene alguna duda.\r\n\r\n\u00a1Gracias por comprar en nuestra plataforma! Vuelve a visitarnos aqu\u00ed: Regalalo.PE\r\nSi tienes alguna pregunta acerca de tu pedido, contacta la tienda del producto que tendr\u00e1 el agrado de atenderte. \r\nPara otra consulta de asistencia env\u00edanos un correo a \u003Ca href=\u0022mailto:info@regalalo.pe\u0022\u003E info@regalalo.pe\u003C\/a\u003E",
          "language" : [ "commerce-order:state" ]
        }
      }
    ]
  }
}

This rule works with user customer but not sellerr or authors, what´s your recommendation?


texts: What is the recommended method to add an RSS icon to an Open Scholar scholar site?

texts:
I would like to add a linked RSS icon to the footer of a scholar site using Open Scholar. I know that the URL to an RSS feed will be:
example.com/professorname/feed

However, I'm unsure of how to programmatically get the URL to the scholar site ("example.com/professorname") so I can build the link and insert it into the page.tpl.php for a few scholar sub-themes. Is there a recommended method for this?


texts: How do you 301 redirect links in Drupal via the .htaccess modredirect rules to keep spidered links?

texts: I am migrating a site to a new domain and I would like to do a 301 redirect via the .htaccess file to create a redirect rule. I have over a 1000 dynamic links generated via views so this isn't do able with a redirect module as easily. I just want to get an example modrewrite rule to put in my .htaccess file.


texts: I'd like to use Drupal's email system to programmatically send an email from my custom module. Is that possible?


texts: Injecting Views blocks into another View template

texts:
I have a View containing the latest news in a very standard way (ie: one below the other)... I would like to inject, at certain points, other blocks containing other views (ie: latest news with a certain tag), like in this image:

http://i.imgur.com/6wghpJH.jpg

An easy but impractical approach would be to create different views: one for the latest 2, then one for another 3 news with an offset of 2, etc...

But is there some magic that the new D8 theme layer can do to make this more practical?


texts:
I'm using the video module in combination with the Flowplayer module to allow my users to upload Flash videos. This works fine if autoplay is enabled, however if it isn't, I get the following error message:

  200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] 'http://www.mydrupalsite.com/sites/default/files/''

Am I doing something wrong?


texts: Adding the button implemented from "Printer, e-mail and PDF versions" in node.tpl.php

texts: I am using Printer, e-mail and PDF versions, and I was wondering if there were a way I could place the print button in node.tpl.php above the $content area, instead of through the Drupal administration area. Could that be done through a variable?


texts: Required message given in datelist field is not working

texts:
I have created a webform and it's working fine, but the datelist field doesn't take the required message which given in the webform. It's displaying required message appended to the label with a date.

How can I add my own required message?


texts: In the default installation, settings.php is located at sites/default/. There are no recommendations in the official Drupal website about changing the location of this file. Doesn't it pose a potential problem of security? I have seen Apache webservers eventually failing to interpret PHP files, and serving the content of the PHP file in pure plain/text format, instead of the supposed HTML content. That would completely expose the database connection user and password, which is not even encrypted. Why does it work this way?


texts:
I'm writing a new Drupal theme. I have a html.tpl.php and a page.tpl.php (soon to add a set of node.tpl.php's for each different content type). I want my page.tpl.php to be used for every page, including the front page — every page is going to have exactly the same layout, so I don't need a page-front.tpl.php.

When I visit www.example.com/node/whatever, my page.tpl.php is applied.

When I visit www.example.com (the front page), my page.tpl.php is completely ignored — I'm assuming that Drupal is looking for page--front.tpl.php, not finding it, and then ignoring my page.tpl.php.

How do I get Drupal to use my themes page.tpl.php template for the front page?

edit:

Apparently my front page isn't even being counted as a node?!? The below code will die on any page except for the front page:

function cefmap_preprocess_page(&$vars, $hook) {
    if (isset($vars['node'])) {
        die;
    }
}

How do I get my front page to be treated as a node like any other node?

edit:

Think I've worked this out, and it's really dumb of me. I set that node to "be the front page" through structure, menus, main menu and then set the path for the link to be "<front>".

Of course, that just changes the link in the menu to be "/", without changing the actual path of the node. So I don't actually have a node at "/", and so I don't get to have a page template or a node template applied.


texts: Last Comment Name field is not removed after account cancellation

texts:
After cancelling the user under(Delete the account and make its content belong to the Anonymous user). Forum posted by is changed to "Anonymous" but
comment name is still displayed in the forum.

Also i noticed it in the table, node_comment_statistics

How can i remove the Last Comment Name while cancelling, because i need to remove entire user information from my database.

Update 1:

Last_Comment_Name is mapped from the table Comment column name


texts: Retain content while deleting user using services

texts:
I need to delete a user account using services module & does it fine.

I can see that content(forum) created/updated by the user gets deleted.

Is it possible to achieve below screenshot option via services module in drupal 7?


texts: How to customize how field is displayed in view

texts:
UPDATE: Thanks to Molot I now see how I can edit the output of the view using the specific tpl file for that field. However I'm still not sure how to refer to that field and print it within that tpl file.

I have a file field in a custom content type that I'm displaying in a view. I want it to spit out the path to the file and nothing else in the view so I can do whatever I want with it. I have customized the views-view-unformatted-nameofview.tpl.php so it doesn't wrap the entire view with the default drupal divs and classes, like so:

<?php foreach ($rows as $id => $row):
    print $row;
endforeach; ?>

Which works but is there a way to customize how it spits out a specific field?
Even though I customize the html style to none it still tries to do things like display a custom icon for my file which I don't want. I'm also rewriting the output of the field in the view like so

I want to embed it into an img tag but what I end up with is

    maps.svg

When all I want it to display is

I would normally use an image field but it doesn't seem to allow to add svg as an acceptable file type. I'm open to other ways to go about it, but even if that's the case it'd still be nice to know how to edit the field output in views. I'd rather not install a pre-existing module if at all possible. However I would understand if that is the only reasonable course of action.


texts:
I set up a Drupal 8 CMS  at http://mydrupalsite.com/.I successfully created a RESTFul API at http://mydrupalsite.com/api/v1/newsarticles.  My API pulls content by doing something like

$query = \Drupal::entityQuery('node')
    ->condition('type', 'newsarticles')
    ->condition('status', NODE_PUBLISHED)
    ->range(0, 1);

However, I noticed that I can still see content at http://mydrupalsite.com/node/<integer>.   What's the best way for my headless CMS to NOT expose content other than to:

administrators who need to edit the content
expose content only via the API end points


texts:
I have a pretty specific case where I want to fill in the node title myself if the user fills a checkbox above the title field.

For this reason, I can't use autonodetitle (because the title is only automatic if the checkbox is selected).

I have added my own validation callback using array_unshift() in a hook_form_alter to make sure its the first one but when its called the form already has an error (title field is required)

Is there any way I hook into the validation process earlier or even just remove the error for this field?

Thanks!


texts: Feeds import from RSS changing dates to current timestamp

texts:
I'm trying to import some old news items from a legacy site/system.

Using feeds importer to get the content from an RSS feed.

All works fine except the published date value gets rewritten to the timestamp at point of import. I can't find an option to change this behaviour, even using the 'tamper' module doesn't seem to assist.

Any suggestions?


texts: How change widget of a "between exposed filter" to combo box?

texts:
I have a view that has some exposed filters. One of the filters is on the price of the content type. I want to filter contents by price when price is between two known value. For example I want to filter all the content that their prices are between 0 and 5000. The other thing I want is a select box for this filter. So the filter is a select box with some options like below:

<option>0-5000</option>
<option>5000-10000</option>
<option>10000-15000</option>
<option>15000-20000</option>

I add a filter to the view and mark it as exposed filter, then change its operator to between. Now what should I do to change the widget from two text box to a single select box?


texts: Skip save of field collection attached to entity without removing reference to field collection?

texts:
I've got a node form encumbered with many field collections and node save takes forever.

I would like to "lock" some of those field collections and forgo saving them on node save. Kind of like skip_host_save but the opposite.

I've tried removing the field collection form elements but that deletes them from the node.

Here's the function I have which deletes the field collections from the node, called from hook_form_alter.

/**
 * @param $element FC to unset.
 *
 * Unset all the form api fields that would cause this field collection to be saved.
 */
function freshstop_usability_unset_fs(&$element) {
  foreach(element_children($element) as $index){
    unset($element[$index]);
  }
  unset($element['#entity_type']);
  unset($element['#bundle']);
  unset($element['#entity']);
  unset($element['#field_name']);
  unset($element['#columns']);
  unset($element['#element_validate']);
  $element['field_locked_markup'] = array(
    '#markup' => 'This field collection is older than one year and can no longer be edited.'
  );
}


texts: How to implement separate billing/shipping addresses and prevent use of PO Boxes?

texts:
Because our products already have shipping included in the prices (using Commerce 2), we have no need for a separate shipping module or calculation. However, we do need separate billing and shipping address fields during the checkout process and a way to prevent PO Boxes from being used as the shipping address.

Why you might ask?  Because for some people living in rural areas or small communities, they often have a physical address that is recognized by UPS for packages, but have a PO box assigned by the US Postal Service for regular mail.  The Post Office will not deliver to their physical address and considers it an invalid address. So the PO Box will be used for billing to match their credit card, but we need to prevent that from also being used for their shipping address, as the client uses UPS exclusively.

How can this be implemented?  Both separate billing/shipping fields and excluding PO Boxes in the shipping address.


texts: How to change the text format of the body field of 200 nodes at once?

texts:
I need to change the Text format of the body field of 200 node of the "flats" content type.

I guess I can do it in the database but I don't know where to look.


texts: use EntityFieldQuery to find user based on profile field value

texts:
I have a field within the user's profile set with their payroll. What I'm trying to achieve within my module is find the uid, based on the value of a payroll field.

I've tried a few things, but I can't get it to work. What I'm currently trying is this, but it returns unknown field of user

$query = new EntityFieldQuery();

$query->entityCondition('entity_type', 'user')
  ->fieldCondition('user', 'field_user_payroll', $payroll, '=');

$result = $query->execute();
$account = user_load($result);

$wrapper = entity_metadata_wrapper('user', $account);
$mimemail = $wrapper->mimemail->raw();

watchdog('Photo Import', "Mimemail: %mimemail",
  array('%mimemail' => $mimemail), WATCHDOG_INFO);

Any help would be really appreciated. It's driving me crazy!


texts:
How can I apply a conditional fitler to a view (using views 2)?

For example:
I have a view which displays the teasers for several different node types using a filter on Node:Type in [Blog entry, Forum topic, User profile]

This works well for showing all nodes of those types, but suppose I only want to show a user's profile if it has a picture as well (and all of the other types).


texts: Privatemsg with user_relationships - views link → send a private message to use

texts: Trying to output Views link - send a private message to a user. But its displaying nothing. Using privatemsg 6.x - 2.x Dev version and user_relationships 6.x - 1.x


texts: Unable to add field in administer field tab

texts:
I am trying to add fields in Drupal 8 to a existing entitiy. The "administer field" tab is visible but the button for adding fields is missing there. The button is also missing when creating new entities.
Similar questions guided me to check if the "field ui" module was installed and enabled which it is. Tried reinstalling and flushing the cache without any luck. Permissions should not be a problem since i have tried this while logged on with the default admin user.
I am not sure what triggered this, we are a team working on the site and we use git and jenkins to deploy our changes. Because of this i am not sure what commit caused the add field button to disappear.
Does anyone have an idea why the add field button could disappear?


texts: How to programmatically create an entity and fill in entity reference fields

texts:
I'm trying to create an entity that has a number of entity refernce fields, and I'm confused about the best way to do that. so far I've gotten as far as this

$entity = entity_create('mytype', $values);
$entity->field_ref = array('und' => array(0 => array('value' => "2")));

Creating the entity works fine, but I can't for the life of me figure out how to fill in the entity references.


texts:
I need to check whether a certain table field is of type 'int' (I am referring to table schema)

e.g. for table field_data_field_myfield
field_data_field_myfield_value  is of type int(11)

I actually need a generic function that check if a certain field is of type in the schema.

[Edit]

I want to explain better my difficulty:

I have a feature that holds a certain field of type 'datetime'. Now as this type creates performence problems on database sides, I decided to change it to 'datestamp' [= unix format]. I did this editing the file MYFEATURE.features.field.inc that is a database field table mirror.

Now the reports are:

FieldException: Cannot change an existing field's type. in field_update_field()

This is an exception raised due to the fact I am not supposed to alter schema while data is in. Therefore I create a hook_update_N for data migration.

Now I believe I need to do a hook_update_N for schema migration too.
HERE is the point I need to alter schema in a hook_update_N.


texts: Why can i not add a new link to the main menu?

texts:
I cannot for the life of me figure why i cannot add a new link to the main menu?!

the error i get reads

'The path 'events' is either invalid or you do not have access to it.'

i have tried numerous work arounds, tricks, checked permission, menu modules, everything i can think of but i cannot understand why.

am clueless, does anyone here know?


texts: display status report even though the module is disabled

texts:
I want to execute some code in my custom module to display status reports even though my custom module is disabled.

Hook_requirements can be used to display status reports. But it seems that it only works when the module is enabled. I want this to work even though the module is disabled.

Please tell if anybody knows the solution. Thanks in advance.


texts: Login destination to file download - prompt user

texts:
we have some private file links that are pasted into emails. When a user clicks the link, if they are not logged in they get something like this:

http://mysite.com/user/login?destination=/system/files/private/myfile.docx

Once they login and authenticate, the file starts to download in the user's browser.

I'd like to override the automatic download behavior and provide a "download this file?" type prompt first, since users don't often realize the file download starts automatically.

Any ideas? Thanks in advance.


texts: Drupal in Azure behind Loadmaster - HTTPS enforced no CSS

texts:
I bow to those who can help me out with this. I've done this with F5 before but for some reason this isn't working.

Drupal 7 sitting behind a Kemp LoadMaster, behind an Azure Load balancer. With Kemp redirecting from 80 to 443 and handling the ssl offload. I have tried every solution found and still the site loads partially with HTTPS, with most of the content trying to load through http.

https://demo.omegasys.eu is the site. Any help here is appreciated and I'm willing to post the config files if needed.


texts: Drush is updated but not usable in Drupal 8 in Windows

texts:
Is this a bug? I've the version that does support Drupal 8, so what is actually the problem here?

Update

I followed kiamlaluno and seem to have updated Drush but I still get the same error. I haven't touched the settings.php file. It's a totally brand new site so I would still get an error :\


texts: Change the permissions needed in a service to get info from a module?

texts:
I'm adding Services integrations to the Room Reservations module. A service I need to expose is the times when reservations can be made. I found a function inside room_reservations.inc (the function is _room_reservations_facility_hours()) and created a action type of service pointing to that function.

The problem here is that only the administrator user can have access to the output of this web service, whenever another user (even with the Administrator role) consumes the service I receive a 403 error. Is there a way I can solve this?

The Service declaration

$room_service = array(
    'room_reservations'=>array(
    'actions'=>array(
    'get_times'=>array(
      'help'=>'Gets the hours and the days reservations can be made',
      'file'=>array(
        'type'=>'inc',
        'module'=>'room_reservations',
        'name'=>'includes/room_reservations.service'
        ),
      'callback'=>'_room_reservations_service_get_open_hours',
      ),
  ),
),

The callback function (which connects to _room_reservations_facility_hours())

function _room_reservations_service_get_open_hours(){
  $dates = _room_reservations_facility_hours(TRUE);
  $i=0;
  $realDates = array();
      foreach ($dates as $key => $value) {
      //array_push($realDates, $dates[$key]);
        //$realDates[$key]=$dates[$key];
        if ($i<8) {
          $realDates[$key]=$dates[$key];
          $i++;
        }

    }
  //$standarized[] = $dates;
  $standarized[] = $realDates;
  return $standarized;
}

Edit: I'm already using the CSRF Token as a header when consuming the service


texts: How to make menu badges count disappear after the page is viewed?

texts:
With reference to my previous question which was a little confusing or I should say it was mixed up with two different problems. I am posting my question again with clarification.

I have created a view, which shows activity logged by Message module. I then created a menu badge using menu badges module which shows the numbers on the menu item. - In start, when there is no activity, it shows 0, After there is new activity, say 2 new activities, the number changes to 2, which is correct, but when the page is viewed the count remains the same and does not decrease or disappear i.e 2, which is wrong. This is the problem. When the page is viewed, the number must disappear until and unless there is new activity.

Currently I am using Message:Message ID in the field to count. I have 3 different message types and I am showing it in one view. Actually, I am trying to create a notifications system. When, the user you are following does some activity, you will be notified.

Coming back to issue. For example, the menu badges module comes with a default badge for the private messages module (it allows users to send/receive messages to/from each other). It is working perfectly as the badge disappears when the users reads all the private messages and it reduces as well. Private messages module does not provide a view so i cannot see how it is working with the menu badges module.

Extra clarifications:

if the user visited the page containing the view that shows 2 rows corresponding to those 2 new activities, then both of those 2 new activities should no longer be included in the counter for its menu badge.
I wont use a pager. All items will be listed on the same page.
We only want menu badges to show count of new activities which the user haven't seen yet i.e the user haven't visited the page containing the activities-logs/notifications. Simply, when the user visits the page, the menu badges count must disappear.
Visiting the page means user has seen the notifications/new activities and now the count should not be visible as there is no new activity. As it happens on stackexchange websites: when you click the notification, the count disappears.


texts: Why can Wordpress ship with latest version of jQuery but Drupal cant?

texts:
Just a general question to as what holds Drupal back from being able to use the latest version of jQuery? I am guessing it is something technical but would like some details.

Even jquery update module only updates a few versions for Drupal 7 it goes for 1.4.4 to 1.5.2 while Wordpress ships with 1.7.1

Drupal 6 to jQuery 1.3.2
Drupal 7 to jQuery 1.5.2 and jQuery UI 1.8.11


texts: D6 - Trying to display variable_get()s in a block

texts:
I am trying to display 4 variables in a custom block(created from my custom module). I am accessing the variables using variable_get('$myvariable', '0').

I am not able to display the array in the block "$content" - is my code not handling the renderable array properly?

 function neil_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
  return array(
    0 => array(
      'info' => t('Custom Neil Block'),
    ),
 );

case 'view':
    $subject = '';
    $content = '';
    switch ($delta) {
        case 0:

          $block_content = "";

          $block_content = array(
            'content'   =>  array(
                'blockvar_progress_so_far'          =>            variable_get('progress_so_far', '0'),
                'blockvar_number_of_projects'       => variable_get('number_of_projects', '0'),
                'blockvar_dollars_raised'           => variable_get('dollars_raised', '0'),
                'blockvar_number_children_impacted' => variable_get('number_children_impacted', '0'),

            ),
          );

          $content = $block_content;
          $subject = t('Subject in My Custom Block');
        break;
    }

    }
return $block;
break;

}
}

Instead of the "$block_content", I only see the following: "Array"


texts: Do i need to worry about using deprecated functions in Drupal 8?

texts:
I'm finding Drupal 8 a pretty steep learning curve, and quite often when I do find a solution that works PhpStorm tells me that the function I'm using is deprecated.

E.g. this answer shows how to list a bundles fields, however entityManager is deprecated and will removed before Drupal 9.

How long before Drupal 9 will this be removed? Like next week, next month, next year or in several years just before D9 is released.

Do I need to worry about using deprecated functions? Is it best practice to avoid them all together?


texts: views - group by first letter of results

texts:
As the title describes, I am trying to group the results of a view by their first letter. Googling revealed a way for me that half does the trick : display title twice, exclude from display, limit to 1(st) character, group by that. Clever I must admit but i need to reveal a grouping field even if there are no results in it such as:

A
  Alpha
  Anekin

B
  Bravo
  Borvo
C

D
  Delta
  Dooku

Any thoughts on how to go about doing that?


texts:
ok heres the thing.

Im working on a one-step checkout with drupal commerce, but keep encountering issues xD

the setup has 2 shipping methods, one is a flatrate and second is "pickup at store".

When the user selects "Pickup at store", he needs to press a link to open a Ctools modal, presenting a list of available stores, wich also are presented on a googlemap in this modal dialog.

My issue now is to return the selected store from the Ctool modal, back to the checkoutpage.

Currently what i do is setting the selected location in the cart_orders data array, saves the order and replace some HTML with the address of the selected location.

After doing this, i have to submit the checkout form twice, to complete the order?
First submit does aparently nothing (i suspect it somehow updates the order??) and second submit completes the checkout.

Questions are
   1) Are there any better way to append the selected location to the order??
   2) By any chance any of you have experienced the "double submit" for completing the checkout?


texts: Show a Unique Header Image based on Path in Drupal 7

texts:
I'm trying to customize the header with an image for each path; if not, put a default image. I found a way to do Lullabot, but it is for Drupal 6.

Is there any option for Dupal 7?

theme-settings.php

/**
* Implementation of hook_settings() for themes.
*/
function MYTHEMENAME_settings($settings) {
    // This ensures that a 'files' directory exists if it hasn't
    // already been been created.
    file_check_directory(file_directory_path(),
        FILE_CREATE_DIRECTORY, 'file_directory_path');
    // Check for a freshly uploaded header image, save it to the
    // filesystem, and grab its full path for later use.
if ($file = file_save_upload('header_image',
    array('file_validate_is_image' => array()))) {
$parts = pathinfo($file->filename);
$filename = 'MYTHEMENAME_header_image.'. $parts['extension'];
if (file_copy($file, $filename, FILE_EXISTS_REPLACE)) {
    $settings['header_image_path'] = $file->filepath;
    }
}

// Define the settings-related FormAPI elements.
$form = array();
$form['header_image'] = array(
    '#type' => 'file',
    '#title' => t('Header image'),
    '#maxlength' => 40,
);
$form['header_image_path'] = array(
    '#type' => 'value',
    '#value' => !empty($settings['header_image_path']) ?
    $settings['header_image_path'] : '',
);
if (!empty($settings['header_image_path'])) {
$form['header_image_preview'] = array(
    '#type' => 'markup',
    '#value' => !empty($settings['header_image_path']) ?
        theme('image', $settings['header_image_path']) : '',
    );
}
return $form;
}

template.php

/**
* Implementation of hook_preprocess_page().
*/
function MYTHEMENAME_preprocess_page(&$variables) {
  $settings = theme_get_settings('MYTHEMENAME');
  if (!empty($settings['header_image_path'])) {
    $vars['header_image_path'] = $settings['header_image_path'];
  }
  else {
    $variables['header_image_path'] = path_to_theme().'/head.jpg';
  }
}

I tried using the Header image module but it is not working; the other option I have is to make a content type with a view and relate them to the nid.

Which option do you recommend?


texts:
I have copied a Drupal installation onto my local machine and I am now running into an issue where only the homepage will load and all other links return a 404.

Clean URLS are enabled but even attempting to manually type the URL like:

?q=admin/module

fails...

I have tried the following:

Setting AllowOverride to All
including the mod_rewrite module
including the usr_module
setting the baseURL in settings.php

None have yet appeared to have any effect.

Can anybody suggest anything else to try?


texts: I have a view block and I want to add a field link so that will displays a view of the content types that I have create not a content type itself is this possible?


texts:
I have following requirement

I have user with multiple profile type like main profile, personal profile, and role profile

A role profile has fields like

role paid
role status
role start date
role subscription date

A single user can have multiple role profiles and above fields associated with each role profile

I heard about field collection per field which means we can have multiple values per field , But how can we have set of  multiple profile values

Example :

Role name : Moderator
   role paid : yes
   role status : yes
   role start date : xxxxxx
   role subscription date : xxxxxx

Role name : testrole
   role paid : yes
   role status : no
   role start date : xxxxxx
   role subscription date : xxxxxx

and continues...


texts: How do I define multiple blocks in one module and include different javascript for each?

texts:
In Drupal 8

I understand that to create a block I create a file in this structure:

mymodule/src/Plugin/Block/MyModuleBlock.php

If I would like to create another block for this module, or even a dozen blocks in this module, where do I define them so that they render differently and contain different javascript/css?


texts: How to translate the language switcher links

texts:
In Drupal 8.1 the language switcher (block can be placed in a region) shows the languages labels in English:
English | German | French

I want to translate it. Visiting mysite/de the label should be in German:
Englisch | Deutsch | Französisch

mysite/fr --> labels should be translated in French

The words "German" and "French" and "English" are translated into all languages in my drupal installation. Yet the language switcher shows the labels in English all the way.

How translate it?


texts:
Let's say, I have a text field which I use it as a phone number field. I set the number of values to unlimited, so people can enter more than one number.

However, I want to use another text field for the definition of that number. Such as:

Name    Number
====    ======
Home    123456
OFfice  234567
Mobile  456789

How can I combine these two fields and require the Name field to be filled when each time a number field is created?


texts: Trying AJAX autocheckboxes example; getting Notice: Undefined index: #ajax in ajax_form_callback()

texts:
I'm using the exact code found within the examples module function ajax_example_autocheckboxes though I have changed the function and callback names. When I change the select dropdown the field goes gray for a second as the AJAX process kicks off; but no checkboxes appear. I don't think it matters, but my form is in a block defined in my custom module.

I'm getting this in my recent log messages:

Type    php
Date    Wednesday, March 21, 2012 - 12:24
User    me
Location    http://localhost.com/system/ajax
Referrer    http://localhost.com/node
Message Notice: Undefined index: #ajax in ajax_form_callback() (line 379 of C:\Users\me\Documents\www\localhost.com\includes\ajax.inc).
Severity    notice
Hostname    127.0.0.1

UPDATE: I tried the examples module (ajax examples) in a clean D7 install and get 503 errors trying to open the example pages; now I'm investigating my hosting environment (xampp) will update once resolved.

UPDATE2: Installed a bitnami drupal stack & tested ajax examples; everything works as expected which points to an issue with my xampp environment.

FYI xampp details:

    ###### ApacheFriends XAMPP version 1.7.7 ######

  + Apache 2.2.21
  + MySQL 5.5.16 (Community Server)
  + PHP 5.3.8 (VC9 X86 32bit thread safe) + PEAR
  + XAMPP Control Panel Version 2.5 from www.nat32.com
  + (BETA) XAMPP Control Panel Version 3.0.2 by Steffen Strueber (not in the USB & lite version)
    see http://www.apachefriends.org/f/viewtopic.php?f=16&t=46743
  + XAMPP Security
  + OpenSSL 1.0.0e
  + phpMyAdmin 3.4.5
  + ADOdb 5.14
  + Mercury Mail Transport System v4.62 (not in the USB & lite version)
  + FileZilla FTP Server 0.9.39 (not in the USB & lite version)
  + Webalizer 2.23-04 (not in the USB & lite version)
  + Perl 5.10.1 (not in the USB & lite version)
  + Mod_perl 2.0.4 (not in the USB & lite version)
  + Tomcat 7.0.21 (not in the USB & lite version)


texts: public:// urls being printed in source code

texts:
I have a weird issue with a Drupal website I am working on. The site has an audio player, jplayer, that plays MP3 files. Some of the files do not play. The only difference I've found between the files that play and the ones that do not is that the files that do not play have a src in the form of public://audio/example.mp3. The ones that do play have a typical url of http://example.com/audio/example.mp3. Is there anything that I should investigate as to why some of the urls get printed out with a public:// url?

This is the source code that makes the jplayer work..

<?php

/**
 * Implementation of theme_menu_tree().
 */
function wyep_menu_tree(&$variables) {
  return '
' . $variables['tree'] . '
';
}

/**
 * Implementation of theme_file_link().
 */
function play_file_link($variables) {

  //watchdog('theme_file_link', '
' . print_r($variables, TRUE) . '
');

  global $base_path, $base_url;

  $file = $variables['file'];

  $file->url = str_replace('public:/', $base_url . '/' . variable_get('file_public_path', 'files'), $file->uri);

  switch ($file->filemime) {
case 'audio/mpeg':
    return '

fid . '" class="jp-jplayer">

fid . '" class="jp-audio">

play

pause

stop

                            Update Required
                            To play the media you will need to either update your browser to a recent version or update your Flash plugin.

';
  }

}


texts: How to select multiple values from a list block and perform search?

texts:
I am a newbie to Drupal.

I have created a block that contains tags of the important topics on my website so how do I insert a search option for the user so that he can select multiple tags from that block and perform the search operation.


texts: Theme settings to include different PHP files into template

texts:
I'm trying to include a template section into another template under conditions based on the themes settings.

page.tpl.php

    <?php
    $theme_header_style = theme_get_setting('header_style');//the value is 1
    $header_path = "header_tpl_".$theme_header_style.".php";
    include_once $header_path;//includes header_tpl_1.php
    ?>

<?php print $site_name; ?>

header_tpl_1.php

this will show up

<?php print $site_name; ?>

this will show up on page.tpl.php as well

I'm pulling in header_style from my themes settings and for this example the value is 1. The file it will include is being added, as the html from the file is displaying but any php in the file is being ignored. anything on page.tpl.php is working as expected its only the php content on included files like header_tpl_1.php that is not working.

Update

Now that I know using a PHP include doesn't work I would like to know how I could include the contents of the header_tpl_1.php into the template prior to Drupal rendering the page, as this clearly would be the solution. The end objective is being able to load different PHP files into page.tpl.php based on a value set in the themes settings. The code in my header_tmp_1.php was removed from page.tpl.php as working code and put into header_tpl_1.php so I know there are no errors in it, as it works if it's added directly into page.tpl.php. The problem is including content into a template. I need the content to be included prior to Drupal rendering the variables.


texts: Put a parameter in url using Easy Breadcrumb module

texts:
I've a couple of url who use an id in it, I would like to set a custom breadcrumb for them but I can't arrive how to do it.
I tried using * or [0-9] in Paths to replace with custom breadcrumbs but it doesn't do anything.

For example for the url : /fr/checkout/11/order_information
I would like something as : /fr/checkout/*/order_information

Yet I don't know if that is possible, or maybe I'm not looking at the good section ?
Thank you for helping


texts:
I can't seem to find documentation for notifying a user via email after their account has been created by a script.

$user = \Drupal\user\Entity\User::create();

$user->setPassword('xxx');
$user->enforceIsNew();
$user->setEmail('xxx+'.time().'@gmail.com');
$user->setUsername('xxx'.time());

$user->set('init', 'email');
$user->set('langcode', $language);
$user->set('preferred_langcode', $language);
$user->set('preferred_admin_langcode', $language);
$user->activate();

//$user->notify()? something?

$result = $user->save();


texts: Using reverse proxy prevent login flooding

texts:
I have set $conf['reverse_proxy'] = TRUE; in settings.php, but the IP address logged in the flood table is 127.0.0.1, not the one passed through the X-Forwarded-For header. Nginx is configured to send the X-Forwarded-For header to Apache, but it seems Drupal isn't recognizing it.

This is pretty bad because a few failed logins can lockout for everyone.

How can I make Drupal use the IP passed within the X-Forwarded-For header?


texts:
This seems duplicate content, how can i  send a header 410 for the incorrect version of the url and make sure only the correct url is used on the whole website.

This is the original URL: http://www.traveldudes.org/node/2504/
This is the alias: http://www.traveldudes.org/travel-tips/climate-and-best-time-visit-serengeti-tanzania/2504
But what’s this URL? http://www.traveldudes.org/node/2504/gallery
Or what’s this URL= http://www.traveldudes.org/node/2504/map


texts: Using arrays when setting values in defaultConfiguration() of BlockForm in BlockBase

texts:
I'm writing a block plugin that allows you to specify certain values for the block in the panel pane editor.
I'm able to defined the default values using

public function defaultConfiguration() {
    return array(
        'plugins_string' => $this->t('Enter text here'),
        );
}
public function blockForm($form, FormStateInterface $form_state){
    $form['plugins_string_text'] = array(
      '#type' => 'text_format',
      '#title' => $this->t('Block contents'),
      '#format' => 'full_html',
      '#description' => $this->t('This text will appear in the block.'),
      '#default_value' => $this->configuration['plugins_string'],
    );

    $form['layout'] = array(
        '#type' => 'details',
        '#title' => t('Layout'),
        '#open' => FALSE,
        '#group' => 'layout',
        );
    $form['layout']['pane-type'] = array(
        '#type' => 'select',
        '#title' => t('Pane Type'),
        '#options' => array(
            'standard' => t('Standard Panel Pane'),
            'box' => t('Box Layout'),
            'column' => t('Column Layout'),
        ),
        '#description' => 'Choose what type of pane this is',
        '#default_value' => $this->configuration['layout']['pane-type-submit'],
    );
}

I see how to generate the default configuration['plugins_string'] but I'm not sure how to load a default when it is in an array. Like configuration['layout']['panetype-submit']

I have already tried

public function defaultConfiguration() {
    return array(
        'plugins_string' => $this->t('Enter text here'),
        array('layout', 'pane-type-submit') => 1,
        );
}

and

public function defaultConfiguration() {
    return array(
        'plugins_string' => $this->t('Enter text here'),
        'layout', 'pane-type-submit' => 1,
        );
}

Both of these were not successful


texts: How do I port my hook_alter module to D8?

texts:
This is my D7 module (module name is ckeditor_show_blocks):

<?php

/**
 * Implements hook_ckeditor_editor_settings_alter().
 */
function ckeditor_show_blocks_ckeditor_settings_alter(&$settings) {
    $settings['startupOutlineBlocks'] = TRUE;
  }

All it does, it toggles Show Blocks by default on page load in the CKEditor when editing the page/node:

I'm trying to achieve same on D8. I did read some on hooks documentation, and it looked like same, so I didn't change anything, but the module won't apply when in editing mode, what I'm missing? Is hook format different? Does it have something to do with the fact that CKEditor is built-in feature in D8?

There is normal documentation on D7 on how to implement a simple hook module, but not so much about D8.


texts: XML feed data's are importing with the XML tags

texts:
I have created a XML feeds by the tutorial, but I have found one problem that the XML tags are also appending to data, ie title, description and salary tags are also there
The output is following

<title>Drupal Developer 100</title>

<description>A job creating applications with Drupal.</description>

salary:
<salary ccy="usd">60,000</salary>

The output shows like below, I want to remove <title>

EDIT 1

I get the answer by this tutorial, just uncheck the check-box under "Select the queries you would like to return raw XML or HTML" in XPath XML parser settings


texts: How to perform action after a file is deleted?

texts:
Is there an API hook I could use to run some custom PHP code after a file is deleted? I need access to the name of the file which has just been deleted.

I attempted using hook_nodeapi, and testing for when the operation is delete, but it seems by this stage the file row has been removed from the database, and I'm left with just information about the node itself.

I'm using Drupal 6. (I see that Drupal 7 does have a hook: hook_file_delete)


texts: Show full content of related entity using Entity Reference in node view

texts:
Basically I've created a relationship between two content types: Testimonials and Case Study as follow: in Case Study I've created a field Testimonial using the Entity Reference widget.

When I create a case study type of content I can choose a Testimonial to link with this case study. So far so good.

My question is this: When I view the newly created Case Study content, I can only see the title of testimonial but none of the additional field available in the testimonial content type.

In order to view the full content, do I need to create a View for it or is there a way to display the full content as it is?

Thanks


texts: How to save custom label as parameter for a custom entity_reference field widget?

texts:
I am creating a custom field widget for an entity_reference field. This has a custom select field and an Ajax Submit button. Once the user selects an option (entity) from the select_field and submits it, I am adding the entity in a dragTable below.

I could achieve that until now, but my need is to add a custom label for the entity selected. I provided a textfield to capture the custom values and I am able to fetch the values. But, I am unable to save this custom text_field data. I am extending the core WidgetBase class for my custom field Widget.
For an entity_reference field, is it possible to save custom label parameters along with the entities?

Updated:
After enabling fieldType, duplicate results are appearing while creating field. Any help on this? .


texts: Should I use the Rules module to implement custom code when performing state transition?

texts:
I need to run some custom code when I go from state A to state B (using the workflow module).

Should I implement this with the Rules module and call my function from there or implement all of it in hook_workflow from a custom module?

In short, what is the Drupal approach?


texts: Upgrading multiple modules at once crashes the process

texts:
Just upgraded from 7.18 to 7.23 and selected to upgrade all modules and all I got is neverending 'Preparing to update your site' on Installing updates page on /authorize.php?batch=1&op=start&id=40

So what if I refresh page or something will the site crash or something?

UPDATE: It just crashed after like 20 minutes of nothing and I got this error:

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /authorize.php?batch=1&id=40&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {queue} WHERE (item_id = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 8656 ) in SystemQueue->deleteItem() (line 273 of /modules/system/system.queue.inc).Uncaught exception thrown in shutdown function.PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: UPDATE {batch} SET batch=:db_update_placeholder_0 WHERE (bid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] =&gt; a:12:{s:4:&quot;sets&quot;;a:1:{i:0;a:15:{s:7:&quot;sandbox&quot;;a:0:{}s:7:&quot;results&quot;;a:2:{s:3:&quot;log&quot;;a:1:{s:5:&quot;views&quot;;a:1:{i:0;a:2:{s:7:&quot;message&quot;;s:57:&quot;Installed &lt;em class=&quot;placeholder&quot;&gt;views&lt;/em&gt; successfully&quot;;s:7:&quot;success&quot;;b:1;}}}s:5:&quot;tasks&quot;;a:0:{}}s:7:&quot;success&quot;;b:0;s:5:&quot;start&quot;;d:1377856599.71076107025146484375;s:7:&quot;elapsed&quot;;i:0;s:5:&quot;title&quot;;s:18:&quot;Installing updates&quot;;s:12:&quot;init_message&quot;;s:40:&quot;Preparing to update your site&lt;br/&gt;&amp;nbsp;&quot;;s:8:&quot;finished&quot;;s:38:&quot;update_authorize_update_batch_finished&quot;;s:4:&quot;file&quot;;s:35:&quot;modules/update/update.authorize.inc&quot;;s:16:&quot;progress_message&quot;;s:29:&quot;Completed @current of @total.&quot;;s:13:&quot;error_message&quot;;s:22:&quot;An error has occurred.&quot;;s:3:&quot;css&quot;;a:0:{}s:5:&quot;total&quot;;i:12;s:5:&quot;count&quot;;i:12;s:5:&quot;queue&quot;;a:2:{s:4:&quot;name&quot;;s:17:&quot;drupal_batch:40:0&quot;;s:5:&quot;class&quot;;s:10:&quot;BatchQueue&quot;;}}}s:16:&quot;has_form_submits&quot;;b:0;s:11:&quot;current_set&quot;;i:0;s:11:&quot;progressive&quot;;b:1;s:3:&quot;url&quot;;s:36:&quot;/authorize.php?batch=1&quot;;s:11:&quot;url_options&quot;;a:0:{}s:10:&quot;source_url&quot;;s:0:&quot;&quot;;s:8:&quot;redirect&quot;;s:28:&quot;/authorize.php&quot;;s:5:&quot;theme&quot;;s:5:&quot;seven&quot;;s:17:&quot;redirect_callback&quot;;s:11:&quot;drupal_goto&quot;;s:2:&quot;id&quot;;s:2:&quot;40&quot;;s:13:&quot;error_message&quot;;s:110:&quot;Please continue to &lt;a href=&quot;/authorize.php?batch=1&amp;amp;id=40&amp;amp;op=finished&quot;&gt;the error page&lt;/a&gt;&quot;;} [:db_condition_placeholder_0] =&gt; 40 ) in _batch_shutdown() (line 537 of /includes/batch.inc).


texts: Different sets of language icons per theme

texts:
I'm using Language Icons and Language Switcher modules. The flag icons are added to the language switcher block, but the icons are stored in sites/all/modules/languageicons/flags. They are of fixed height of 12 pixels by default and they are used by every theme.

I want to use different sets of flag icons with different dimensions per theme, for example, Theme 1 will use the default icons of 12x12 pixels, but Theme 2 will use the icons of 19x19 pixels. I will have my custom flag icons in my custom module or in my custom themes.

I would do this by using hook_block_view_alter() to override the block output per theme, but I'm looking for a better and right way.


texts: Turn off template suggestion for specific fields

texts:
I have the problem, that the theme / template suggestion comments destroy the html when they are outputted as values.

{% set img_uri = "fields.img.value"%}

{{ dpm(img_uri)
style="backround:url({{ createMyImagePathCustomTwigFunction(img_uri) }});"

Results in:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_field' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/views/views-view-field.html.twig' -->
public://img/person/joshua-ness-117255-unsplash_0.jpg
<!-- END OUTPUT from 'core/themes/stable/templates/views/views-view-field.html.twig' -->

<!-- END OUTPUT from 'core/themes/stable/templates/views/views-view-fields.html.twig' -->

..as wrong uri.

I know that I could dive deeper into the rendered array to find other versions.

However:
To change production templates in general only for enabling a developing environment seems wrong to me.

Better would be a hook that would remove field tpl suggestions in general as I don't need them.

I know I can write handler functions... that is what I do in the moment.

But cleaner would be to turn the suggestions off for views fields. How this can be done?


texts:
I am having difficulties setting up an endpoint with the services module to download a file. Ultimately I want the user to hit the services end point with something like /api/download/file/fid and it will download the file to the users machine. The reason I want to do it through services and not just get users to hit /sites/default/files/file.filetype is because I need to be able to restrict access to the download link with HTTP basic auth. I have tried searching but cannot find how to achieve this? any help is much appreciated.

EDIT:
My xml response when I imported arpitr's endpoint configuration and called it.

<result>
    <fid>6</fid>
    <uid>1</uid>
    <filename>Transition1.jpeg</filename>
    <uri>public://Transition1.jpeg</uri>
    <filemime>image/jpeg</filemime>
    <filesize>435007</filesize>
    <status>1</status>
    <timestamp>1475199010</timestamp>
    <type>image</type>
    <uuid>4c703ad2-290c-4573-9a29-a7e86e1a874e</uuid>
    <field_file_image_alt_text/>
    <field_file_image_title_text/>
    <rdf_mapping/>
    <metadata>
        <height>2304</height>
        <width>3072</width>
    </metadata>
    <alt/>
    <title/>
    <height>2304</height>
    <width>3072</width>
</result>

I am missing <file> which is the content of the file base 64 encoded, any idea why this could be?


texts:
Is there any way to make some nodes accessible to anonymous users in drupal and rest of the nodes content accessible to only authenticated users . I have a site which offers questions for practice . I want to keep some nodes(questions) accessible to anonymous users to see a sample before they can decide to be a premium user .
Any pointers on this is highly appreciated .

Regards
Meenakshi


texts: I facing a problem when i want create two registration forums by using (profile2 & profile2 registration path) modules?

texts:
i want create two registration forums ,each forum in specific page , when i looking for solution in internet, i found it using profile2 & profile2 registration path modules.

But when i working in it , i facing a new problem , the problem is the users can't find registration forums ,because they doesn't have a link or (way to access in forums ) for registration !?

Example :

i have two roles A & B.

URL path for A : {mysite/A/register}

URL path for B : {mysite/B/register]

When user A click on page to create new account can't going to {mysite/A/register} link !!!

Any ideas ??

thanks in advance


texts: How to avoid admin account to be blocked for all ip's by failed attemps to login?

texts:
In my drupal site, often i see this message for the admin account

Sorry, too many failed login attempts from your IP address. This IP address is temporarily blocked.

I know i can solve it clearing the 'flood' database table, and i'm almost sure it is caused by people or bot trying to login as admin. 'Almost' for in the table flood the failed attemps have identifier '1-127.0.0.1' that is the local ip and it sound strange to me...
There is a way to avoid the problem for good? (and to be sure it is about people/bot trying to login and not something else?)

(I mean obviously a convenient way. Allowing all the login attemps without blocking them is not a solution.)


texts: How to highlight active teaser in Views?

texts:
Using Views and Panels, I have an unordered list of node teasers that appears on every page. When viewing a node, I would like to highlight that node's teaser in the list.

Class .active gets applied to the teaser link, but I'd like to apply it to the whole list item. Is this possible?


texts: How to get variables of field from a view in twig?

texts:
I'm trying to style the title field from a view. So I create this template

views-view-field--frontpage--title.html.twig

And when I was trying to see what variables are avaiable in this template level. I decide to add

{{ kint() }}

And for some reason it showing me this huge error.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: CREATE TABLE {cache_render} ( `cid` VARCHAR(255) BINARY CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.', `data` LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.', `expire` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry should expire, or -1 for never.', `created` DECIMAL(14, 3) NOT NULL DEFAULT 0 COMMENT 'A timestamp with millisecond precision indicating when the cache entry was created.', `serialized` SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whether content is serialized (1) or not (0).', `tags` LONGTEXT NULL DEFAULT NULL COMMENT 'Space-separated list of cache tags for this entry.', `checksum` VARCHAR(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT 'The tag invalidation checksum when this entry was saved.', PRIMARY KEY (`cid`), INDEX `expire` (`expire`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Storage for the cache API.'; Array ( ) in Drupal\Core\Render\RenderCache->set() (line 275 of core/lib/Drupal/Core/Render/RenderCache.php).The website encountered an unexpected error. Please try again later.

I think this might be a Drupal 8 bug, but I'm not sure.

So my question are..

How can I get the variables ? Or at least the field value so I can added wrapper around it.
In Drupal 8, do you think I went to deep on this template ? I notice that using the theme_debug functionality I could not see this template suggestion.


texts:
I am trying to contribute Drupal modules and placed my first project on drupal.org.

Is it possible to see if a proprietary project on drupal.org has been downloaded and how many times?


texts: In drupal 7, I have revisions turned on, and I want to make a view to display the last updated date and the user who last updated it.  The problem is I cannot get a field for "revision user" as an available field to see .    The only revision fields available are the updated date, and log message.


texts:
Is it possible to create a view from third-party source that includes html, js and css?

Example: http://www.addyosmani.com/resources/shinetime/

I want to create a view of the example shown in the link and display it as a block on my site.
Is there an automated process for doing this or I would have to do it manually? If manually then how? Thank you


texts:
I'm trying to use the Migrate API module to implement an ETL for some of the content of my Drupal 8 website, but the documentation doesn't explain how to execute the migration once everything has been set up. It only explains how to execute the migration using some contributed modules but not how to execute it using the Drupal API.

How do I programmatically execute migrations from a module?


texts: Creating conditional fields: How should I implement hook_form_alter()?

texts:
Backstory: I used and highly enjoyed Conditional Fields modules for D6 in the past. Currently using 7.x-3.x-dev. But had some issues recently with it and would rather just learn how to do it manually. Familiar with Devel, but had no luck successfully getting a complex hook_form_alter() to work. Always end up hitting a dead-end.

What are the fundamentals of implementing a hook_form_alter()?

I'd like to get this process laid out and in one single location. Thanks.


texts:
In my website, I'm using ApcheSolr with facet api and with some configuration I listed facets blocks and it works fine!

But now I want to create a block that list to me the active filter chosen by user

I read some facet api documentation but I'm lost !!

Can anyone help me!

Tanks in advance.


texts: How to create file field instance that allow teaser and full description and not allowed extensions but denied extensions?

texts:
I need to change the default Drupal functionality of file field:

I want to be able to allow upload of all files types, EXCEPT the extensions listed (reversing the current funcitonality)
I also want to be able to add a teaser field and a description field to the file.

Any ideas?


texts: Making a custom module that alters a view query?

texts:
I am super new at Drupal module development, so I wanted a little bit of input on where best to go from here.
I need to create a View that shows events in a specific order that the default Views don't provide. I'm trying to make a custom module, and use views_query_alter() in the .module file to alter how events on my site are displayed.
I've watched so many module development tutorials and I'm still confused on where to go from here. In all the module development videos I've watched, there's an src folder with PHP code. Right now I have src->Plugin->views->query->[queryname].php, along with my other necessary folders and files.
Would I be putting my views_query_alter() function in there? Or in the .module file?
Sorry for the sheer stupidity of this question, just trying to figure out where best to go from here. Thank you!


texts: Update.php with errors in multisite (WAMP)

texts:
I have 4 sites using the same features / modules and have the db main (general), and a "bd for each site." Sure, but the update modules / drupal core is made only once. During the execution of update.php I get the error:

An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.
Please continue to the error page
An AJAX HTTP request terminated abnormally. Debugging information follows. Path: http://LINK_OF_SITE.com.br/update.php?op=selection&token=ouRkHusqVcR48Xy0n-j8hc-C2pMOEc3ABwv7oMgHbzo&id=99&op=do StatusText: ResponseText: ReadyState: 4

What should I do? I'm using WAMP (localhost) with Apache (2.4.9) and PHP (5.5.12) and MySQL (5.6.17)

in the log, http://teste/mea/?q=admin/reports/dblog

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table 'teste_mea.backup_migrate_sources' doesn't exist: SELECT * FROM
  {backup_migrate_sources}; Array ( ) in
  backup_migrate_item->all_items() (line 923 of
  C:\wamp\www\TESTE\sites\all\modules\backup_migrate\includes\crud.inc).


texts: Does anonymous can access current node? How to check it in my module?

texts:
I need to do something witn current node by my module only if anonymous users can view this node. How to check it?

By default I use $node->status == 1, but some other modules can change anonymous access rights also for published nodes.


texts: Is it helpful to improve performance by mysql table indexing?

texts:
Yes I am talking about manually indexing drupal cache table.
Is it helpful to improve site performance by indexing cache table?
For ex::
SELECT cid, data, created, expire, serialized, tags, checksum FROM cache_default WHERE cid IN ( 'locale:en::anonymous' ) ORDER BY cid;


texts: Add different classes to the images that where uploaded with multi-upload

texts:
I'm looking for the best solution to add different classes to images that where multi uploaded to one field.

So not a class to the field, but a possibility to add different classes to each single image...

So my client will be able to add for ex. the class 'right' that will let the image float to the right and be only 60% width. And then for a other image add the class 'left' for example...

So if you look at the image above, you see my client can add for each image a different alt and title. There should show up there a space where he can add for each image a different class.

Any tips, links or other sulotions to reach my goal are welcome!
Thanks in advance.


texts: Block form send email to recipients from a view

texts:
We have a view which can be filtered.
We need a block which can be used to send a message with the recipients coming from the view.
Ideally this would be on the same page.
This would be used by anonymous users so the interface needs to be simple.
We have tried views send but the form is too complex to present to anonymous users.

Possibly an entity form where we can define the fields, user selects the recipients from the view, fills the simple block form and send.

Any ideas much appreciated.


texts: Executing a view programmatically with input filters

texts:
I've created a View to search for suitable jobs. Along with View I want to give a "Subscribe" button for those who want matching jobs(if any) be delivered in their inbox daily. I want to save the input entered in the exposed filters and run the View at night in a batch for all those who have subscribed for jobs.

I will add a "Subscribe" button along with "Apply" in the Views form. So if any logged-in user selects the "Subscribe" button I want to: 1) Save the input of exposed filters; 2) Run this view every night and see if any new matches are found; 3) Email the user with new jobs found.

Is there any easy way to do it? Is there any module to help me?

I can use Views Saved Searches module to save current user selection of exposed filters.  This input could be fed when calling view programmatically.

Also two more useful links: Using Views Programmatically Drupalcamp & get the result view creates.

EDIT:
I need someone to provide me practical in-use implementation that can save my time.


texts: I have two databases set in my settings.php file. One is used for drupal, one is for our backend which is external from the drupal installation and databases. I would like to query the backend database but cannot change the db_active because then our site users will have issues accessing their profiles. How can I go about connecting to the two databases simultaneously?


texts: Creating a watchdog log when publishing status changes on my own ContentEntityBase

texts:
I have a hierarchy of Entities derived from ContentEntityBase. Now I want to create a log when the publishing status ( = status field) changes.

What is the best method to override/implement for this purpose? In the Entity that extends ContentEntityBase or in the Form that extends ContentEntityForm?

Or somewhere else? I don't want to use a hook!

Thanks. Rainer.


texts:
Installing drush is never the same on every linux system apparently. I'm on redhat 7 and and I just setup php 5.6 and installed composer, but I can't do a composer install on the fresh git repo of drush.

I'm getting the following error:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

      Problem 1
        - Installation request for d11wtq/boris v1.0.10 -> satisfiable by d11wtq/boris[v1.0.10].
        - d11wtq/boris v1.0.10 requires ext-posix * -> the requested PHP extension posix is missing from your system.
      Problem 2
        - Installation request for phpunit/phpunit 4.6.6 -> satisfiable by phpunit/phpunit[4.6.6].
        - phpunit/phpunit 4.6.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.

It's complaining about phpunit not being installed. So I went ahead and installed it:

  PHPUnit 5.6.2 by Sebastian Bergmann and contributors.

And I still get the same error when doing a composer install.

Can someone please explain why this always happens? You try to install something and it complains something isn't installed. You install that thing, but it still complains. Or better yet, you install something and it complains that something isn't installed and you install that thing and it complains some other thing isn't installed. Wasn't these package managers suppose to solve these dependency issues?


texts: How to modify field_suffix after form submit?

texts:
I have a form with a custom suffix (#field_suffix) for a field. I need to change the suffix value after the form has been submitted. Which hook should I use to achieve this ?

Sample Code :

$form['field_test']['#field_suffix']='Suffix-1';

Edit:
I want to show "Suffix-1" when editing form and "Suffix-2" during display of content.


texts: get all nodes created in a specific month

texts:
I have a custom search form that I posts a year + month, such as
2014-04
I would like to get all nodes created that month, when I create the timestmap I use:
"SELECT .......         AND changed >= 'strtotime($date)'"

This is the code for form date:

$form['aqar_date'] = array(
'#type' => 'date_select',
'#title' => t('Date'),
'#prefix' => '

Node date
',
'#suffix' => '
',
'#date_format' => 'Y-m',
'#default_value' => date('Y-m'),
'#date_year_range' => '-4:+0',
);

This is the form submit:

$start_date = strtotime($date);
$query = "
SELECT `nid` FROM `node`
WHERE
`type` = 'custom'
 AND `changed` >= '$start_date'";

But I'm not getting, I need a way to specify to only this month period not this month and newer!

Thanks!


texts:
I can't test sending emails with Drupal 7 on my local host. I have been searching for some solutions for more than 10 days but unfortunately the problem still exists.

Any help?


texts: How can I require that browscap.ini / get_browser() is functioning before allow a my module to be installed?

texts:
I have a module for my Drupal 7.x installation which needs browscap.ini / get_browser().

The module works perfectly, but I want to make sure the browscap.ini is installed before installing of enabling the module. That way the module will not work unless browscap is installed correctly.

How can I do this?


texts: How to change the entity view display configuration programmatically?

texts:
In a hook_install implementation, I need to change the entity view display configuration of certain bundle / view mode combinations. For instance, I would like to change the 'teaser' view  mode of the 'article' bundle and hide 'field_image'.

When you export the configuration, you'll see those settings stored in core.entity_view_display.node.article.teaser.yml. I know it's possible to load the configuration like this:

$view_mode_config = \Drupal::configFactory()->getEditable('core.entity_view_display.node.article.default');

This would allow you to change and save the config object, but I suppose that is not the correct way to do it. I'm guessing there must be some kind of view mode manager class I should use to do this, but I haven't been able to find it.

So how do I change the entity view display configuration programmatically?

Bonus question: When you find yourself in a situation like this, what are your strategies to explore the code and find the classes you need?


texts: drupal loses track of a library (leaflet), randomly

texts:
I have an strange problem with a library (leaflet).

I have some maps, and it works fine, but randomly (as far as I have been able to detect) drupal is unable to find leaflet.js and leaflet.css (it is allways located in sites/all/libraries/leaflet , as indicated in leaflet drupal module website).In fact I can see in Firebug that Drupal is not even trying to get the library (I get no server error message saying it cannot find the files or similar)

When this 'error' happens, I have to do strange things like moving the leaflet.js file to another folder or change the name and then, after drupal fails and I rename the file again, MAYBE drupal is able to find it again. Sometimes it seems like flushing cashes helps but not allways...I know it sound dummy but it only happens with this libarry and it seems completely random. Hours wasted trying to set up again...

The folder is 755 in permissions. Have tested in a different PC and the same problem! changing browser or clearing its cache doesn't help neither.

thanks in advance


texts:
Using Drupal 7 and Commerce, I created a field on my products (/admin/commerce/products/types/product/fields)

New price field called "Shipping Price" (field_shipping_price)
So now I can apply a static flat rate to each product when I create the product nodes.

How can I use this value to calculate the shipping value for the order?  I assume it would be done with Rules or a custom module, both work for me. I am having trouble finding the right fields to get it working (with rules).  Anyone have any insight?


texts:
I am trying to extend the Thunder Admin theme by creating a sub-theme in it. This is my first time making a sub-theme in Drupal 8 (other than from bootstrap starter kits).

I would have thought that a basic sub-theme would have inherited the css and js from its parent as is explained here

All I can see that I should need to do is to create a directory i.e. my_theme and create my_theme.info.yml and my_theme.libraries.yml.

The content of this file is as follows:

my_theme.info.yml

name: My Theme
type: theme
core: 8.x
base theme: thunder_admin
description: 'Extends Thunder Admin'

libraries:
  - thunder_admin/global-styling

regions:
  header: 'Header'
  pre_content: 'Pre-content'
  highlighted: Highlighted
  content: Content
  page_top: 'Page top'
  page_bottom: 'Page bottom'
  sidebar_first: 'First sidebar'
regions_hidden:
  - sidebar_first

my_theme.libraries.yml

global-styling:
  css:
    component:
      css/style.css: {}

Can any one please explain to me where I am going wrong please?
I have flushed every cache I can think of


texts:
I need your help I need to make a very custom way of scoring quizzes and need some opinions and ideas.

I'm making a job applicants website, when you try to apply to a job in the website you have to take a quiz, and if you pass it your resume is sent to the creator of the job.

The complex part is that the quiz for the job is bound in the job content type with an entity reference field, the creator of the job can choose the quiz with an autocomplete field.

Now, I already have that part until the applicant finishes the quiz and then notify the creator of the job (instead of the creator of the quiz) if the applicant passed the quiz.

What I do not know how to do, is that the result of the quiz must be scored by the creator of the job, and not by the creator of the quiz.

A quiz can be reference to unlimited jobs, but when a quiz is bound into a job and somebody applies to a job, and answer the quiz, the results must be scored by the creator of the job instead of the creator of the quiz.

Any ideas how to achieve this?


texts: Creating a view that shows multipule blocks containing content with filtered by differnt taxonomy terms

texts:
Im looking to create some pages that contain blocks of content based on a separate taxonomy term for each block.

Right now i created a separate block view for each taxonomy term, and added each view into its own block on the block administration page. (http://cs.scottrlarson.com/services)
It works, but I want to have more control over the container of the set of blocks as a whole so I can style the blocks in a flexbox. I wondered if there was a way to create a view that had different blocks filtered by taxonomy terms for each block that way I could set a style name for the container of the blocks allowing me to use flexbox styles.

If anyone has a better way to do this please let me know. Thanks.


texts: How can I find specific block name in structure->blocks in drupal-7?

texts: I can see specific block in the home page. I need to show this block in specific roles. How I can find this block in the list of blocks in structure->blocks?


texts:
I have this scenario in my application:

Every registered member, can manage up to 3 content-types. And manage nodes based on their own content-types. They can manage their own content-types and nodes.

edit: the number of registered members might reach more than 1000

How can I approach this?

opening administer content-types permission for authenticated-users is definitely not an option. Also there could be a lot of confusions regarding dynamic permission, custom roles, etc...

Is creating content-type of node-content-types possible?

Are there any contributed modules or distribution for this specific features?

Thanks

edit02: Some explanations, I hope it's clear..

user can manage his content-types by: creating new content type, edit/delete existing ones. he also can manage his nodes too.
also, different user, cannot see other's content-types, but can see other's published nodes
All content types (and it's fields) shouldn't be overlapped. maybe the user's name is included in the content-type machine name generator (and field's) to avoid duplicates
I'm not sure about the idea "creating content-type of node-content-type"


texts: Making the size of two fields in comment form the same programmatically

texts:
in my node comment form I have a 'your name' field and an 'email' field for users to fill out. They are different in length and like them both to be length '30'. How can I do this with hook_form_comment_form_alter?

I've tried this, with no success (in template.php):

$form['field_email']['#size'] = 30;
$form['author']['#size'] = 30;

I've tried just changing the size of the field for the email field in the content type comments manage fields area but it does nothing.


texts:
I have an installed Vote Api in Drupal 8 site.

Also, installed Postman application in my browser.

Just a simple and quick question.

Is there any way to call the Vote Api via REST?


texts: Register User with Services (JSON) with Custom Fields

texts:
I am trying to register a new user on Drupal7 via services with JSON. Actually I am posting info from JAVA (android) with JSON format to the server with services module enabled. A sample successful JSON post is:

    {
    "name": "erfan",
    "pass": "1234",
    "mail": "erfan@example.com",
    "status": "1"
     }

  URL: [siteURL]/[endpoint]/user/register

I was successful creating users with basic info such as name,email,status.

I have added custom fields like field_address, field_phone, etc to the web site and want to send them via JSON to the server.

The problem is I can not figure out how to post these data to the server and couldn't find any documentation about it. My trial and error approach was not successful too, because I am not good in PHP coding. So please help me. Thanks.


texts: Acquia installation is up-to-date but requests update and reports errors

texts:
I have installed Acquia Dev Desktop in order to have a local Drupal development environment. My computer is running Windows 7. The prototype site provided with the installation appears to run fine, but there are two problems in the dashboard.

(1)
Under "Reports > Status report", the section on "Drupal core update status" is in red and says, "See the available updates page for more information and to install your missing updates." The words, "available updates" in that are linked. When I click that, I get "All of your projects are up to date" plus a link for "Check manually". When I click that, it works for a while and then says, "Checked available update data for 5 projects. ... All of your projects are up to date."

So Drupal both reports being up-to-date and says that there are "missing updates."

(2)
Under "Reports > Available updates", there is a red box at the top of the page with four bullets:
• Notice: Undefined index: reason in theme_update_report() (line 86 of C:...\local\DrupalDev\DrupalTest\modules\update\update.report.inc).
• Notice: Undefined index: in theme_update_report() (line 137 of C:...\local\DrupalDev\DrupalTest\modules\update\update.report.inc).
• Warning: date_timezone_set() expects parameter 1 to be DateTime, boolean given in format_date() (line 2040 of C:...\local\DrupalDev\DrupalTest\includes\common.inc).
• Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in format_date() (line 2050 of C:...\local\DrupalDev\DrupalTest\includes\common.inc).

Below that, under the heading, "Drupal core", there is a yellow text box. In the top right corner is a warning icon (dark yellow triangle with exclamation mark) and the box has the following text:
"Acquia Drupal 7.34.40 (Drupal 7.34 core)
Recommended version: ()
Includes: Acquia Connector, Bartik, Block, Color, Comment, Contextual links, Dashboard, Database logging, Drupal 7 driver for SQL Server and SQL Azure, Field, Field SQL storage, Field UI, File, Filter, Help, Image, List, Menu, Node, Number, Options, Overlay, Path, Pathauto, RDF, Search, Seven, Shortcut, System, Taxonomy, Text, Toolbar, Update manager, User"

===================

I found the recommendation to use Acquia Dev Desktop in three places:

www.drupal.org/node/1248034

www.drupal.org/node/263

www.drupal.org/node/1065212

which are the links in the first, second, and sixth bullets in "Local server setup" at www.drupal.org/node/157602 .

So it comes highly recommended. But the above behavior looks pretty flaky. Have I done something wrong with the installation?

Thanks for your help.


texts: How to trim trailing spaces from labels of radio buttons/select list elements

texts: Every label of every element of every list has trailing space, and it is annoying and makes styling sometimes hard or in certain ways impossible. I was trying to add :before pseudo element to label with content: "\0020";, to make trailing spaces symmetrical at least, but it doesn't work. How to get rid of them?


texts: I want to change the default sorting order of a pre-populated Solr search page (the option "Show enabled facets' blocks in their configured regions and first page of all available results" under "Behavior on empty search" of the Advanced Search Options). I thought the solution would be setting a custom filter but I cannot find the right syntax: I tried everything from "solrsort=ds_created:desc" to "sort=created:desc" and all the variants between... but I failed... Anyone may help me please?


texts:
How to create custom contextual filter for views using views api.

I have a custom table which is having some statistics data about the user. The user id is also stored in the table.

I managed to get the results using views api, Now I would like to use the contextual filter on the logged-in user, this is where I got interrupted. The contextual links are empty, its not showing any filters I can use of. How do I get contextual filters working using views api?